I wrote an article on this just last week; this might help:

http://www.jeremy-burns.co.uk/2009/11/cakephp-dynamic-navigation-bars/

On Nov 30, 3:53 pm, davido <[email protected]> wrote:
> Hello, I´ll try to make a web app for a small business owners web
> presence. I found cakephp as the right tool for fast development.
>
> Now I have wrote my model and controller classes and the views. In the
> layout I would like to switch the visability of the menu by a simple
> Callback function.
>
> Am I right using the beforeFilter for passing active state to the view
> as in the example I found 
> on,http://old.nabble.com/beforeFilter-on-app_controller-and-on-posts_con...,
> google?
>
> Ex:
>
> app_controller before filter:
>     function beforeFilter() {
>                 $this->set('SiteRoot', '/bla/');
>                 //default menu to nothing
>                 $this->set('MenuSelected', '0');
>     }
>
> post_controller before filter
>     function beforeFilter() {
>                 parent::beforeFilter();
>                 $this->set('MenuSelected', '1');
>     }

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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to