zoukankan      html  css  js  c++  java
  • YII CMenu配置

    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>
    ...
  • 相关阅读:
    easyui好例子,值得借鉴
    DDL 和DML 区别
    兼容IE的文字提示
    搭代理
    美国服务器
    跟随滚动条滚动
    JS Array对象
    JS 内置对象 String对象
    JS 对象
    JS 二维数组
  • 原文地址:https://www.cnblogs.com/zaric/p/2729324.html
Copyright © 2011-2022 走看看