Question

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),
    ),
));
Was it helpful?

Solution

array('product/new', 'tag'=>'new') will create a url like index.php?r=product/new&tag=new, which means in actionNew of ProductController, $_GET['tag'] = 'new';

OTHER TIPS

hold on there bubba. i would NOT remove those references. if the code runs as a whole, there is a new object somewhere!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top