![]() |
Get name of controller from view (without passing it as a variable) - 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: Get name of controller from view (without passing it as a variable) (/showthread.php?tid=12395) |
Get name of controller from view (without passing it as a variable) - El Forum - 10-17-2008 [eluser]blasto333[/eluser] Is there a native way to get the name of the controller from within a view? Get name of controller from view (without passing it as a variable) - El Forum - 10-17-2008 [eluser]xwero[/eluser] Code: echo __CLASS__; Get name of controller from view (without passing it as a variable) - El Forum - 10-17-2008 [eluser]blasto333[/eluser] This still has to be done from the controller because in the view the class is CI_Loader Get name of controller from view (without passing it as a variable) - El Forum - 10-17-2008 [eluser]SitesByJoe[/eluser] You could do a good old: Code: <?php And that would certainly work from a view. If you're talking about it happening on the client end you would need to use javascript to get the same effect. I'm not aware of any problems that would occur using this method. Get name of controller from view (without passing it as a variable) - El Forum - 10-17-2008 [eluser]narkaT[/eluser] Code: get_class(); works for me so far ![]() |