I’m trying to use Yii for a site with a lot of static pages.
So I have in the SiteController the following action
'show'=>array( 'class'=>'CViewAction', ),
And the following route to make the urls shorter:
And of course there is the CMenu as well:
<?php $this->widget('zii.widgets.CMenu',array( 'items'=>array( array('label'=>'Home', 'url'=>array('/site/show', 'view'=>'index')), array('label'=>'About', 'url'=>array('/site/show', 'view'=>'about')), array('label'=>'Contact', 'url'=>array('/site/contact')), ), ); ?>
The generated menu works as expected. The only problem I have is that if you call the index.php (without any route), the menu item ‘Home’ is not marked as ‘active’. Although Yii is correctly loading /site/show with view=‘index’. Is there a way to solve this problem?
I already tried these rules:
''=>array('site/show/', 'view'=>'index'), '<view\w+>'=>array('site/show', 'defaultParameters'=>array('view'=>'index')),
However, it does not change anything - except that now Yii generates urls like /index.php/?view=about.
Thanks in advance!