Home
Forums
Members
Search
Help
New topics
Todays topics
Website
Welcome Guest, Not a member yet?
Register
Sign In
Login
Username:
Password:
Remember me
Lost Password?
CodeIgniter Forums
Archived Discussions
Archived Development & Programming
Current controller
Share on Google
Share on Facebook
Share on Twitter
View a Printable Version
Subscribe to this thread
Add Poll to this thread
Send thread to a friend
Linear Mode
Threaded Mode
Current controller
El Forum
Guest
#1
12-04-2008, 09:52 AM
[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...
El Forum
Guest
#2
12-04-2008, 10:00 AM
[eluser]gullah[/eluser]
$this->uri->segment(1);
El Forum
Guest
#3
12-04-2008, 10:11 AM
[eluser]Mat-Moo[/eluser]
I should of guessed really, but wiki just says it return all - TY.
El Forum
Guest
#4
12-04-2008, 10:39 AM
[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
El Forum
Guest
#5
12-04-2008, 10:43 AM
[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
El Forum
Guest
#6
12-04-2008, 04:31 PM
[eluser]louis w[/eluser]
I think __CLASS__ would work too.
--------------------
Private Messages
User Control Panel
Who's Online
Search
Forum Home
General
-- News & Discussion
-- Events
-- Lounge
-- Regional User Groups
Using CodeIgniter
-- Installation & Setup
-- Model-View-Controller
-- Libraries & Helpers
-- Best Practices
-- Choosing CodeIgniter
-- General Help
CodeIgniter 4
-- CodeIgniter 4 Roadmap
-- CodeIgniter 4 Development
-- CodeIgniter 4 Feature Requests
-- CodeIgniter 4 Support
-- CodeIgniter 4 Discussion
-- CodeIgniter 4 Addins
Development
-- CodeIgniter 3.x
-- CodeIgniter 2.x
-- Issues
-- NetBeans Plugin
External Resources
-- Spotlight
-- Learn More
-- Jobs
-- Addins
Archived Discussions
-- Archived Libraries & Helpers
-- Archived Development & Programming
Theme © iAndrew 2016 -
Forum software by © MyBB