isreal
(Jisrael Tapiah)
1
hi!
is there a way to customize application.components.MainMenu for make it dinamically with dropdown, or do I have to programming as I want?
at this moment I have
<?php
foreach($list as $label => $url):
$menu[$i]['label'] = $label;
$menu[$i]['url'] = array('/'.$url);
$menu[$i]['visible'] = $visible;
$i++;
endforeach;
$this->widget('application.components.MainMenu',array(
'items'=>$menu
));
?>
that works but what whether i want to make dropdown menu?
great framework!!
qiang
(Qiang Xue)
2
The MainMenu component included is mainly for demo purpose.
I don't think it is very suitable to be extended to support css or js-powered menus.
jonah
(Poppitypop)
3
I renamed it from MainMenu to Menu and extended the code:
http://code.google.c…onents/Menu.php
You may use it like this:
<?php
<?php $this->widget('application.components.Menu',array(
'items'=>array(
array('Home', array('site/index')),
array('Contact', array('site/contact')),
array('Users', array('user/list')),
array('Posts', array('post/list')),
array('News Archive', array('post/news')),
array('Groups', array('group/list'), 'visible'=>Yii::app()->user->hasAuth(Group::ADMIN)),
),
'view' => 'mainMenu' //the view to use to render the menu, contained in /protected/components/views
)); ?>
Example of a menu view: http://code.google.c…ws/mainMenu.php
You may then change the view to display it in any way you want.
sebas
(Sebathi)
4
Did you try this extension?
I didn't do it until today. Maybe tomorrow
http://www.yiiframew…ryslidetopmenu/
JMNorris
(Jemandy)
5
While we're on the topic of the MainMenu component, where does it's color get set? It's not in main.css (at least as far as I can see).
jonah
(Poppitypop)
6
I believe the color is part of the background image
isreal
(Jisrael Tapiah)
7
thank you so much for the answer, very helpful! cheers