I have two templates to integrate in my front website and my CMS.
-
My end-to-end website is a high menu generated by the CMS
-
CMS top menu which is the constant menu by me ("Manage page", "manage user", "manage products") Although this menu is still stable, I still want to assign an appropriate class to the appropriate top menu item. Example: If I'm managing some pages on the site then the "Men Pages" link should be highlighted and selected. How would I go about this? Something I need to code myself or is there an existing function in yii that I need to refer to?
Thank you in advance Yii Newbie
My Controller (
AdminController's Extension Controller ) I have several "menu" functions in the class. I make an active set on every need, and based on what I am getting active on the basis of that work, I have an active set. For example:
secure function getAdminMenu ($ activeTitle) {return array (array ('label' = & gt; 'manage page', 'url' = & gt; array (' / User / purchase ('/ user / user', 'url' = & gt; array ('/ user / index'), 'active' => ($ activeTitle == 'manage user') is true: Incorrect);}
You can do this where it looks like the controller or action or URL request and also sets the appropriate menu item active. This is an example.
Then in my opinion, if I want to present the menu with "Manage Page", then I set the menu of my layout using the function in my controller class :
$ this-> Menu = $ this-> getAdminMenu ('Manage Page');
(It assumes that You have the
public $ menu = array (); declared in your controller, as well as the blog example to see that it is Works:
$ this- & gt; Widget ('zii.widgets.Cenu', array ('items' =>> $ this-> menus,));
)
I hope this gives you some direction!
Comments
Post a Comment