24 June, 2012

Get controller name in view with codeigniter

Getting controller name in view with codeigniter is simpler than anything else. Just use one line of the code and you get the name of controller in view in codeigniter. Use this in any view file:


$controllerName =  $this->router->class;
echo "My controller name is:".$controllerName;