Welcome Guest, Not a member yet? Register   Sign In
Controller name in the view
#1

[eluser]zovar[/eluser]
Is there a way to get controller name inside the view file? I want to use separate css files depending on what controller loads this view, so I need to know controller's name.
#2

[eluser]JWarren[/eluser]
Code:
echo $this->uri->segment(1);
#3

[eluser]zovar[/eluser]
Ha-ha, where was my head?! ))

Thank you!
#4

[eluser]Colin Williams[/eluser]
better to use rsegment() because segment() will give you the pre-routed path, which won't necessarily be the controller name.
#5

[eluser]Unknown[/eluser]
What about
Code:
get_class(get_instance())
?

The documentation says get_instance() provides the "CodeIgniter super object", but as it turns out, this is the current controller.
#6

[eluser]Otemu[/eluser]
Check out this post here, number of methods how you can achieve loading different css depending on the view
this http://ellislab.com/forums/viewthread/233286/
#7

[eluser]Aken[/eluser]
Four year old thread...




Theme © iAndrew 2016 - Forum software by © MyBB