Keeping parent menu items active in child pages |
A very simple solution and works fast. Instead of using a controller you can do it directly in the views page where your navigation (menu) file is written.
<?php $segment = $this->uri->segment(1); ?> Then in your Dropdown menu: <li class="sub-menu"> <a href="javascript:void(0);" <?php echo ($segment == 'settings-seo' || $segment == 'settings-email') ? 'class="active"' : 'class=""'?>> <i class="fa fa-cogs"></i> <span>Settings</span> </a> <ul class="sub"> <li><a href="settings-seo">Search Engines</a></li> <li><a href="settings-email">Email Template</a></li> </ul> </li> Is there a way we can paste code snippet properly in this forum? |
Messages In This Thread |
Keeping parent menu items active in child pages - by ahmadmilzam - 11-16-2014, 10:42 AM
RE: Keeping parent menu items active in child pages - by alroker - 11-16-2014, 12:32 PM
RE: Keeping parent menu items active in child pages - by ahmadmilzam - 11-16-2014, 06:27 PM
RE: Keeping parent menu items active in child pages - by Hobbes - 11-17-2014, 12:02 PM
RE: Keeping parent menu items active in child pages - by ahmadmilzam - 12-18-2014, 03:48 AM
RE: Keeping parent menu items active in child pages - by InsiteFX - 12-18-2014, 05:18 AM
RE: Keeping parent menu items active in child pages - by apparasenal - 12-18-2014, 11:41 PM
RE: Keeping parent menu items active in child pages - by _this - 12-19-2014, 02:04 AM
|