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. 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.
$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!!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.