[英]sidebar menu doesnt show up Yii
I've been trying now for an hour to figure out how $this->menu works in Yii views. 我已经尝试了一个小时,以弄清楚$ this-> menu在Yii视图中如何工作。 I found that you just put this in view file of controller and it should work, but for me it doesnt appear on web page.
我发现您只是将其放在控制器的视图文件中,它应该可以工作,但是对我来说,它不会出现在网页上。
$this->menu=array(
array('label'=>'create', 'url'=>'/create/')
);
In your default layout used in controller for example: 例如,在控制器中使用的默认布局中:
public $layout='//layouts/column2';
You will find this in {appdir}/views/layouts/column2.php
path. 您可以在
{appdir}/views/layouts/column2.php
路径中找到它。 In this template you need to have this where you want to show the custom menu: 在此模板中,您需要在其中显示自定义菜单:
<?php
$this->beginWidget('zii.widgets.CPortlet', array(
'title'=>'',
'hideOnEmpty'=>true,
));
$this->widget('zii.widgets.CMenu', array(
'items'=>$this->menu,
'htmlOptions'=>array('class'=>'operations'),
));
$this->endWidget();
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.