我希望能够根据给定的布局添加菜单。例如,如下所示?,如果当前布局是/ entry
,[条目背景]变得可见<?php $this->widget('zii.widgets.CMenu',array(
'items'=>array(
array('label'=>'Entries', 'url'=>array('/entry'),'authItemName'=>'SuperUser','visible'=>Yii::app()->user->checkAccess('SuperUser')),
array('label'=>'Entries Background', 'url'=>array('/entry/more'),'authItemName'=>'SuperUser','visible'=>$this->layout = '/entry'),
),)); ?>
感谢
答案 0 :(得分:0)
也许你可以试试这个:
<?php $this->widget('zii.widgets.CMenu',array(
'items'=>array(
array('label'=>'Entries', 'url'=>array('/entry'),'authItemName'=>'SuperUser','visible'=>Yii::app()->user->checkAccess('SuperUser')),
array('label'=>'Entries Background', 'url'=>array('/entry/more'),'authItemName'=>'SuperUser','visible'=>$this->layout == '//layouts/entry'),
),)); ?>
我改变了你的状况:
'visible'=>$this->layout = '/entry'
到此:
'visible'=>$this->layout == '//layouts/entry'