Saturday, February 22, 2014

Re: Dynamic menu content in layout

hi, 
You can put the tree menu directly in the layout or in a separate menu elements and include them in a specific place on your layout. 

If you want to highlight active link in your menu, you can do the following: 

// menu

<li class="<?php if($active == 'contacts') {?>active<?php } ?>">..link to contacts views</li>
<li class="<?php if($active == 'posts') {?>active<?php } ?>">..link to contacts views</li>
...

// in Posts/index.ctp
// in Posts/view.ctp
..
$this->set('active','posts');

If you want to dynamically add or modify the sidebar, use and expand the view blocks
http://book.cakephp.org/2.0/en/views.html#extending-views

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: