Current controller - 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: Current controller (/showthread.php?tid=13755) |
Current controller - El Forum - 12-04-2008 [eluser]Mat-Moo[/eluser] 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... Current controller - El Forum - 12-04-2008 [eluser]gullah[/eluser] $this->uri->segment(1); Current controller - El Forum - 12-04-2008 [eluser]Mat-Moo[/eluser] I should of guessed really, but wiki just says it return all - TY. Current controller - El Forum - 12-04-2008 [eluser]LuckyFella73[/eluser] 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: Code: get_class($this) to get the name of the current controller. Cheers - Luckyfella Current controller - El Forum - 12-04-2008 [eluser]Mat-Moo[/eluser] I have a common header and want to highlight the correct tab for the page your on. but that might be helpful ty Current controller - El Forum - 12-04-2008 [eluser]louis w[/eluser] I think __CLASS__ would work too. |