P
P
Pavel Gogolinsky2014-07-02 13:03:04
Yii
Pavel Gogolinsky, 2014-07-02 13:03:04

How to make a link to the main page in CMenu (Yii)?

<?php $this->widget('zii.widgets.CMenu',array(
   'items'=>array(
    array('label'=>'Главная', 'url'=>array('/')),
)); ?>

'url'=>array('/') - doesn't work if I'm in another controller, 'url'=>array('') is similar

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
twixoff, 2014-07-02
@gogolinsky

Try site/index, or whatever route you have defined as home.

S
Sergey Yakushenok, 2014-07-03
@Casy

Another alternative is to put it like this:
array('label'=>'Главная', 'url'=>'/'),

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question