tags:

views:

27

answers:

1
+1  A: 

In your view

foreach($user['Project'] as $project)
{
   echo $project['title'].'<br />';
}

To see the bigger picture, just use pr(), you should be able to see how to access the rest of the data from there.

pr($user);
Jamesz
thanks for you reply, tried it but getting this error: invalid argument supplied for foreach(). Does it know what projects is? It's not set as it would be in the controller. It's via the association
iamjonesy
Ok... can you confirm that we're not even involving views at the moment. You just want to loop over each 'project' in the 'users' controller? So you're doing something like: $users = $this->User->find(); and a user hasMany projects? If you post some code it would really help out, I'm just guessing here :D
Jamesz
I have updated my question, thanks for helping me out with this!
iamjonesy
I've updated my answer. Keep in mind, that since CakePHP is just returning arrays you can just dump it out with print_r(), or cake's built in pr(), which makes it easier to read by wrapping it in html pre tags. That way, you should always be able to see what data you have, and how to access it.
Jamesz
thanks a lot Jamesz! Sorry for complicating it!
iamjonesy