Re: Social Relationships?

2006-05-31 Thread Nick

Thank you everyone!

Using a combination of: nate's hasAndBelongsToMany tip (something I
should've noticed in the manual) and PhpNut's upgrade suggestion I got
my social networking issues resolved.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Social Relationships?

2006-05-30 Thread Nick

Hi Everyone,

We're building a Social Network app using cake. I ran into a problem I
haven't been able to clear up from the documentation. I need to
establish an association among my members.

1. My PHP version: PHP Version 5.0.5-2ubuntu1.2
2. My Cake version: 1.0.1.2708

I have a Users table, and a Relationship table. Now all would be fine
if I could only follow the convention with associations, but in this
case I don't think I can since I am creating relationships between two
user_id's.

My question is, how do I specify a custom association with Cake, that
lets me establish this social networking table. I need two records
created in the Relationship table (establish relationship) everytime a
User becomes a friend of another User.

Any help would be greatly appreciated,

Thanks!

Nick


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Social Relationships?

2006-05-30 Thread DJ Spark

 On the same topic, I'd like to hear some suggestions on Cake best
pratices to build somethinig like a community website. Stuff like
 -  Should I use Elements to render the different 'boxes' or should I
use the requestAction to get the stuff
 -  How to use 'Pages' in cake ? just pu them in the Pages folder ?
How to call some elements within those pages ? Or i must use
controllers to everything ? I really coudn't find anything on pages on
the manual/api/wiki

  Any suggestions ? Examples ?
 ( the only reference I found:  https://trac.cakephp.org/wiki/Cake/About/Size )

 Thanks!
 spark



On 5/30/06, nate [EMAIL PROTECTED] wrote:

 Okay, this is completely off-the-cuff, but it should at least get you
 started:

 class User extends AppModel {
 var $hasAndBelongsToMany = array('RelatedUser' = array(
 'className' = 'User',
 'foreignKey' = 'user_id',
 'associationForeignKey' = 'related_user_id',
 'joinTable' = 'related_users'
 ));
 }

 This assumes you have a join table called related_users, which has 2
 columns: user_id and related_user_id.

 Hope that helps.


 



-- 
[web] http://synapsisdi.com.br
[livesets] http://djspark.com.br

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Social Relationships?

2006-05-30 Thread nate

The one thing about renderElement is that the element only gets
variables that have been made available to the view by the controller.
If you want to render an element inline (like in a loop), use:

?php include($this-element('element_name')); ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Social Relationships?

2006-05-30 Thread Larry E. Masters aka PhpNut
upgrade to the latest release and the id notice should go away.

-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @accesspublic
*/ 

On 5/30/06, Nick [EMAIL PROTECTED] wrote:
Thanks!That helped - least got me on the right track. But now when I try toadd/edit a user using the scaffolding I get this error - any ideas asto why that might be coming up. The error comes up near every button,
assuming that's cause they all require the ID. The User definitely hasan ID in the model.Notice: Undefined index: id in/var/www/cake/cake/libs/view/templates/scaffolds/show.thtml on line 187


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake PHP group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---