簡體   English   中英

Yii框架CMenu中使用的標簽是什么?

[英]What is the tag used for in Yii framework CMenu?

在下面的代碼,你會看到有一個標簽newproduct/new航線和標簽popularproduct/index路線。 我無法弄清楚這些標簽的用途,即使我刪除了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'] ='新';

保持那里布巴。 我不會刪除那些引用。 如果代碼作為一個整體運行,那么某處就有一個新對象!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM