• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keeping parent menu items active in child pages

#8
(12-18-2014, 11:41 PM)apparasenal Wrote: 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?

You can use these tags :

Code:
[php][/php]

Or :

Code:
[code][ /code] (remove the space)
Reply


Messages In This Thread
RE: Keeping parent menu items active in child pages - by _this - 12-19-2014, 02:04 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.