doh.
so in posts controller:
function index ($category = null){
if ($category){
// add category conditions
}
}
And for categories just query the model, set a variable and display direct
into the layout with a $cats_for_layout or in an element, if you are going
to re-use it.
http://book.cakephp.org/#!/view/1081/Elements
hth
On Fri, Feb 4, 2011 at 7:49 AM, Will Barker <[email protected]> wrote:
> Why not have
>
> function index ($category = null){
>
>
> }
>
> On Fri, Feb 4, 2011 at 6:21 AM, elias <[email protected]> wrote:
>
>> Hi,
>>
>> Assume I have this setup:
>> post table
>> categories table, with a hasMany(post)
>>
>> the index from posts_controller shows all the post items.
>>
>> I want to put an overview on my page of all the categories. (Preferable
>> directly in the layout, because I want it everywhere)
>> Would I put this in an element or something else? And how?
>>
>> If they click on 1 category, i want to show all the post items from that
>> category.
>> Do I use the categories_controller to show that page? Or die I make a
>> custom action in my posts_controller.
>>
>> thx
>>
>> --
>> 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
>> [email protected]<cake-php%[email protected]>For
>> more options, visit this group at
>> http://groups.google.com/group/cake-php
>>
>
>
>
> --
> Will Barker
> aSecondSystem.com
> [email protected]
> 0424 366 468
>
--
Will Barker
aSecondSystem.com
[email protected]
0424 366 468
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php