Re: Help accessing array from HABTM relationship

2009-12-03 Thread Casmit
i think you're right...something like this.

foreach $vars as $var
  foreach $var['user'] as $var2

I'll play around with this...


On Dec 3, 12:17 am, Jeremy Burns  wrote:
> I have spread your array out so I can see its layout. I *think* you'd
> need to do a foreach loop on users too.
>
> On Dec 3, 12:02 am, Casmit  wrote:
>
>
>
> > I have a table called Group that has a HABTM relationship to table
> > Points.  Group also has a HABTM relationship to Users.  Groups_Points
> > table manages this relationship.
>
> > I can run a $this>Point>Group>findAll command and get an array that
> > looks like this:
>
> > Array ( [0] => Array ( [Group] => Array ( [id] => 1 [user_ID] => 1
> > [name] => Dallas Photogs [pic1] => [created] => 2009-12-01 21:23:15
> > [Moderate] => 0 ) [Point] => Array ( [0] => Array ( [id] => 1 [title]
> > => Dallas, Texas [description] => dallas [user_ID] => 1 [type] => City
> > [address] => 101 main st. dallas, tx [city] => dallas [state] => TX
> > [zip] => 76010  [GroupsPoint] => Array ( [id] => 1 [group_id] => 1
> > [point_id] => 1 [created] => 2009-12-02 14:36:10 [modified] =>
> > 2009-12-02 14:36:10 ) ) ) [User] => Array ( [0] => Array ( [id] => 1
> > [username] => John [email] => j...@gmail.com [password] =>
> > 79467e27a472 [first_name] => John [last_name] => Smith  [created] =>
> > 2009-11-24 23:15:16 [modified] => 2009-11-29 01:00:26 [GroupsUser] =>
> > Array ( [id] => 1 [group_id] => 1 [user_id] => 1 [admin] => 1
> > [created] => 2009-12-02 14:36:10 [modified] => 2009-12-02
> > 14:36:10 ) ) ) ) )
>
> > I can do a foreach command in the view i.e. $groups as $group and
> > access Group.Name as $group['Group']['name'].
>
> > What's the best way to access the User.name data in this array. $group
> > ['User']['username'] results in index not found...I see it's nested
> > one level deep.
>
> > Thanks for the advice in advance!- Hide quoted text -
>
> - Show quoted text -

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Help accessing array from HABTM relationship

2009-12-02 Thread Casmit
I have a table called Group that has a HABTM relationship to table
Points.  Group also has a HABTM relationship to Users.  Groups_Points
table manages this relationship.

I can run a $this>Point>Group>findAll command and get an array that
looks like this:

Array ( [0] => Array ( [Group] => Array ( [id] => 1 [user_ID] => 1
[name] => Dallas Photogs [pic1] => [created] => 2009-12-01 21:23:15
[Moderate] => 0 ) [Point] => Array ( [0] => Array ( [id] => 1 [title]
=> Dallas, Texas [description] => dallas [user_ID] => 1 [type] => City
[address] => 101 main st. dallas, tx [city] => dallas [state] => TX
[zip] => 76010  [GroupsPoint] => Array ( [id] => 1 [group_id] => 1
[point_id] => 1 [created] => 2009-12-02 14:36:10 [modified] =>
2009-12-02 14:36:10 ) ) ) [User] => Array ( [0] => Array ( [id] => 1
[username] => John [email] => j...@gmail.com [password] =>
79467e27a472 [first_name] => John [last_name] => Smith  [created] =>
2009-11-24 23:15:16 [modified] => 2009-11-29 01:00:26 [GroupsUser] =>
Array ( [id] => 1 [group_id] => 1 [user_id] => 1 [admin] => 1
[created] => 2009-12-02 14:36:10 [modified] => 2009-12-02
14:36:10 ) ) ) ) )

I can do a foreach command in the view i.e. $groups as $group and
access Group.Name as $group['Group']['name'].

What's the best way to access the User.name data in this array. $group
['User']['username'] results in index not found...I see it's nested
one level deep.

Thanks for the advice in advance!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


trying to Implement ajax stream of new blog post every 5 seconds

2009-12-01 Thread Casmit
I'm trying to implement a feature on our website where the page
displays the latest 10 blog post through an ajax stream.  Every 5
seconds, new post appear in the list and the older post fall off..

Any links/info on how this can be done?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en