[英]What is the tag used for in Yii framework CMenu?
In the following codes, you see there is a tag new
for the product/new
route and a tag popular
for the product/index
route. 在下面的代码,你会看到有一个标签
new
的product/new
航线和标签popular
的product/index
路线。 I can't figure out what these tags are used for, and I can't see any difference in the html output even I remove them. 我无法弄清楚这些标签的用途,即使我删除了html输出也看不出任何差异。
$this->widget('zii.widgets.CMenu', array(
'items'=>array(
// Important: you need to specify url as 'controller/action',
// not just as 'controller' even if default acion is used.
array('label'=>'Home', 'url'=>array('site/index')),
array('label'=>'Products', 'url'=>array('product/index'), 'items'=>array(
array('label'=>'New Arrivals', 'url'=>array('product/new', 'tag'=>'new')),
array('label'=>'Most Popular', 'url'=>array('product/index', 'tag'=>'popular')),
)),
array('label'=>'Login', 'url'=>array('site/login'), 'visible'=>Yii::app()->user->isGuest),
),
));
array('product/new', 'tag'=>'new')
会创建一个像index.php这样的url?r = product / new&tag = new,这意味着在actionNew的ProductController中,$ _GET ['tag'] ='新';
hold on there bubba. 保持那里布巴。 i would NOT remove those references.
我不会删除那些引用。 if the code runs as a whole, there is a new object somewhere!!
如果代码作为一个整体运行,那么某处就有一个新对象!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.