![]() |
Controller name in the view - 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: Controller name in the view (/showthread.php?tid=16048) |
Controller name in the view - El Forum - 02-23-2009 [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. Controller name in the view - El Forum - 02-23-2009 [eluser]JWarren[/eluser] Code: echo $this->uri->segment(1); Controller name in the view - El Forum - 02-23-2009 [eluser]zovar[/eluser] Ha-ha, where was my head?! )) Thank you! Controller name in the view - El Forum - 02-23-2009 [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. Controller name in the view - El Forum - 03-14-2013 [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. Controller name in the view - El Forum - 03-15-2013 [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/ Controller name in the view - El Forum - 03-15-2013 [eluser]Aken[/eluser] Four year old thread... |