Welcome Guest, Not a member yet? Register   Sign In
Active state for current nav item
#1

[eluser]greg.thompson[/eluser]
Hi guys, I'm building my first application with CI and I'm at a point where I'm calling a navigation view within a template view. What I need to do is have the ability to add a class to the currently active navigation element/controller. Here's my navigation view...

Code:
<ul>
<li>&lt;?=anchor('admin/files/', 'Files', 'class = "f_log"'); ?&gt;</li>
<li>&lt;?=anchor('admin/buckets/', 'Buckets', 'class = "b_log"'); ?&gt;</li>
<li>&lt;?=anchor('admin/users/', 'Users', 'class = "u_log"'); ?&gt;</li>
<li>&lt;?=anchor('admin/settings/', 'Settings', 'class = "s_log"'); ?&gt;</li>
</ul>

Being called like this...

Code:
&lt;?php $this->load->view('includes/navigation'); ?&gt;

Now I know I could use something like the uri segment feature but is there anyway to do this without jquery/javascript etc?




Theme © iAndrew 2016 - Forum software by © MyBB