samdark, on 24 March 2010 - 08:56 PM, said:
If h**p://rochat.lan/faro/airport/transfer/Praia+da+Rocha/5 actually leads to 'services/index' route, it will match.
If you want to do it manually:
array(
'label' => 'SERVICES ',
'url' => array('/services/index'),
'active' => true,
)
Another option is to implement your own logic by overriding
http://www.yiiframew...mActive-detail.
Thank you samdark, you were right actually one didn't lead to the other (my mistake). The controllers are actually different.
But I think I cannot do it manually as the widget is on the layout, so the active property has to change, I cannot set it to true, because will be always active.
I think I don't understand quite well the CMenu class.
I did find a solution, maybe not the correct but it works:
In the controller I created a property and then on the action I will tell which menu item I should highlight
class MyController extends Controller{
protected $menuActive;
public function actionIndex(){
$this->menuActive = '/services/index';
}
}
Then on the layout I did
$this->widget('application.components.CMenu', array(
'id' => 'mainmenu',
'items' => array(
array(
'label' => 'ABOUT US ',
'url' => array(
'/site/about')),
array(
'label' => 'SERVICES ',
'url' => array(
'/services/index'),
'active' => $this->menuActive == '/services/index' ? true : null
),
array(
'label' => 'RESERVATIONS ',
'url' => array(
'/site/reservations')),
array(
'label' => 'CONTACTS',
'url' => array(
'/site/contacts')))));
Thank you all for your help.