• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Current controller

What's the best way to get the name of the current controller? I was looking at uri_segments() but I only want the first segment...


I should of guessed really, but wiki just says it return all - TY.

Hi Mat-Moo,

in case you make use of ci routing, the first
url segment may be not the same as the name of your controller.

in that case better write:


to get the name of the current controller.

Cheers - Luckyfella

I have a common header and want to highlight the correct tab for the page your on. but that might be helpful Smile ty

[eluser]louis w[/eluser]
I think __CLASS__ would work too.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.