1

我希望能够根据给定的布局附加我的菜单。例如像下面这样的?,如果当前布局是 /entry,则 [Entries Background] 变得可见

<?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'),
),)); ?>

谢谢

4

1 回答 1

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'
于 2013-08-30T14:16:50.347 回答