Which method can be used in Codeigniter to achieve active menu tabs?
For example I have a user menu Profile Friends Messages Logout
When I\'m in th
As you said in your last paragraph, I would just check for the corresponding URI segment and change the style of the tab based on that.
Let's say you're using a foreach
statement to generate your menu from a database:
- uri->segment(2) == url_title($menu_item->name, dash, TRUE)):?> class="active">>=$menu_item->name;?>
The reason I threw url_title()
in there is to make the name lowercase as the URI segment would be and take care of any possible spaces that may be in the menu name and/or URI segment. This would require the URL helper to be enabled. If they don't match, the default CSS for elements would be used.