Extending CMenu

Hello everybody.

I am trying to create a navigation bar based on Twitter’s Bootstrap. I need to access the class attribute of the ul tag inside the




<div id="mainmenu">

     <ul id="yw0">  // I need to add the class attribute here.



tag.

I realized this is not possible to do with the available properties in CMenu and I possibly need to create my own class that extends CMenu. I found a tutorial on this here.

My question is in which file I need to create my own class that extends CMenu?

I know there are extensions for Yii to work with Bootstrap. But I prefer to learn how to do it my own way.

You could put it in components and add to your import array in your config file.

[color="#006400"]/* Moved from Yii 2.0 Design to Yii 1.1 General Discussion */[/color]

Could you please elaborate on this? Did you mean I can create a file named whatever.php and put in the component folder? Then what needs to be added to the import array in the config file?

Thanks!

Take a look at the files in yii/framework - notice a pattern? :)

The file must be named exactly as the class it defines.

So, if your class is called MyGroovieMenu, then the file should be named MyGroovieMenu.php.

If you place the file in ‘components’ you don’t need to tell Yii to look there for it as it already does.