Welcome Guest, Not a member yet? Register   Sign In
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.

Theme © iAndrew 2016 - Forum software by © MyBB