CodeIgniter Forums

Full Version: Navigation - highlight current menu tab
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]123XD[/eluser]
Hi all,

With the CI, how can I highlight the current menu tab??

Just like the CI home page.

Is there any easy way to do it with CI, or just code as the normal way?

Cheers

El Forum

[eluser]Majd Taby[/eluser]
you could use $this->uri->segment(1) to get the name of the controller, and change styles based on that...

El Forum

[eluser]123XD[/eluser]
Hi Zaatar,

I am still not quite sure``
could u provide a example please?
Thanks

El Forum

[eluser]cinewbie81[/eluser]
$this->uri->segment(1) will get you the current controller name ..

for eg:

url = https://localhost/backup/listing

$this->uri->segment(1) will return u the value 'backup' ..
highlight this 'backup' module use the 1st segment of ur url ..
but i believe there's a better way using CSS ??