Friday, November 4, 2011

Re: How to get related username in view?

On Nov 4, 6:55 pm, Jeremy Burns | Class Outfit
<jeremybu...@classoutfit.com> wrote:
> It's in the right place but you have amended it.
>
> You are populating a variable called $categories - you normally do that for a list. You are using find 'all'  and then restricting it with a condition. Use find first instead (that was my original mistake). Your $category variable is being populated with a read. On the assumption that you want the variable $category to be populated with 'this' category, do this (then check the variable $category in the view - die(debug($category)); is good for that):
>

I tried your code, but I still do not get the related posts appearing
on the category view. Looking at the debug SQL at the bottom of the
screen I see that there is no SELECT statement for the posts table.

>                 $this->Session->write("category_id", $this->_categoryId());  // why are you doing this?

I use that to store the category, so the user does not have to set the
category when adding a new post.

--
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: