navbar - Unable to Highlight/activate menu bar items for static page urls in yii2 -
i using basic yii2 app. using nav bar widget , having problem in highlighting current menu item. problem nav bar items not getting activated when have static pages in url value. e.g when domain_name/site/contact
clicked highlights nav bar item "contact us" it's calling controller action whereas when rendering static pages , using url domain_name/site/page?view=about/about_us
, parent item "about" , child item "about us" not getting highlighted/activated. can't find possible solution it.
the code used given below
[ 'label' => 'about', 'items' => [ ['label' => 'about college', 'url' => ['/site/page?view=about/about_us']], ], ],
and contact us
['label' => 'contact us', 'url' => ['/site/contact']],
i have used following workaround , in nav widget have used
'activateitems'=>'true', 'activateparents'=>'true',
and items
['label' => 'about', 'items'=>[ ['label' => 'about college', 'url' => ['/site/page?view=about/about_us'],'active'=>yii::$app->request->geturl() == url::toroute(['/site/page?view=about/about_us'])],],],
Comments
Post a Comment