Wish I could +1 an email.
On Nov 2, 2011 12:11 AM, "Jeremy Burns | Class Outfit" <jeremyburns@classoutfit.com> wrote:
-- This is basic stuff.--var $actsAs = array('Containable');var $recursive = -1;Ideally do this in app_model so that your whole app uses the Contain behaviour.Your Category find is now:$categories = $this->find('all',array('conditions' => array('Category.category_id' => $id),'Contain' => array('Post' => array('User' => array('User.id','User.name')))));Jeremy BurnsClass Outfit
http://www.classoutfit.comOn 1 Nov 2011, at 20:25, Andras Kende wrote:Since you are showing "posts" on the view maybe it would be better to show that page from posts controller..
It would be easier to get posts category users in a single query..
Andras Kende
On Nov 1, 2011, at 12:41 PM, Daniel wrote:I have a categories view which shows related posts that belong to thecategory. On the posts table there is a user_id which relates to a
username on the users table. I would like to display the username foreach post on the category view, but when I put $post['User']['username'] into the ctp file I get an error message: "undefinedindex: User"--Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.To unsubscribe from this group, send email tocake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment