CodeIgniter Forums
How to set "Current" class while using templates - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to set "Current" class while using templates (/showthread.php?tid=47831)



How to set "Current" class while using templates - El Forum - 12-23-2011

[eluser]trope[/eluser]
I am using templates in my views, by loading a global template:

$this->load->view("template",$data);

but in certain views, such as my HEADER, the view has dynamic content, such as in the code below:

<li class="current"><a href="&lt;?php echo site_url(" title="Dashboard">Dashboard</a></li>
<li><a href="&lt;?php echo site_url('profile');?&gt;" title="My profile">My profile</a></li>
<li ><a href="&lt;?php echo site_url('settings');?&gt;" title="My settings">My settings</a>

as you see, if we are on the DASHBOARD page, then the <li> tag would have the class of "current". If we are on PROFILE page, the that <LI> would have the current class.

How would I implement this?

Thanks!