当前位置:首页 > 开发 > 编程语言 > 编程 > 正文

YII CMenu配置

发表于: 2013-03-20   作者:dcj3sjt126com   来源:转载   浏览:
yii
摘要: Adding id and class names to CMenu We use the id and htmlOptions to accomplish this. Watch. //in your view $this->widget('zii.widgets.CMenu', array( 'id'=>'myMenu', 'items'=>$this-&g

Adding id and class names to CMenu

We use the id and htmlOptions to accomplish this. Watch.

//in your view
$this->widget('zii.widgets.CMenu', array(
	'id'=>'myMenu',
	'items'=>$this->myMenu,
	'htmlOptions'=>array('class'=>'span-24 last'),
));

this will make Yii render

<ul class="span-24 last" id="myMenu">
...
</ul>
 

Adding class names to CMenu items and CMenu item links

We use itemOptions and linkOptions for this. Example.

//in your controller
$this->myMenu = array(
'id'=>'myMenu',
'items'=>array(
	array(
		'label'=>'Home',
		'url'=>array('site/index'),
		'itemOptions'=>array('class'=>'visited'),
		'linkOptions'=>array('class'=>'bar'),
	),
	array('label'=>'Sign Out', 'url'=>array('site/signout')),
),
);

This will let Yii render
...
<ul id="myMenu">
	<li class="visited">
		<a class="bar" href="/site/index">Home</a>
	</li>
...

YII CMenu配置

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号