Bootstrap Twitter CSS Active Navigation

Hey guys,

Are you worried to make active navigation for your webpage link defaultly..instead of mentioning class=”active” statically??

Then its very simple to achieve..Even myself felt fool for not achieving with logic instead went for google 😛

Just add this code in <li> tag like <li code>

code:

<?php if (basename($_SERVER[‘REQUEST_URI’], “.php”) == “members”){

echo ‘class=”active”‘;
} ?>

In total it appears like..

<ul class=”nav nav-pills”>
<li <?php if (basename($_SERVER[‘REQUEST_URI’], “.php”) == “members”){
echo ‘class=”active”‘;
} ?>><a href=”<?php echo base_url().’main/members’?>”>Home</a></li>
<li <?php if (basename($_SERVER[‘REQUEST_URI’], “.php”) == “perffactors”){
echo ‘class=”active”‘;
} ?>><a href=”<?php echo base_url().’main/perffactors’?>”>Performance Factors</a></li>

<ul>

That’s..very simple na.. 😉

Advertisements