Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get current controller

in a function I want to reach current controller:

$front = Zend_Controller_Front::getInstance();

this only gives a handler but not current controller.

I changed the code from function to inside of controller. and asked their origins both the handler I got from getInstance and this

var_dump(get_class($front), get_class($this));

I get:

string 'Zend_Controller_Front' (length=21)
string 'IndexController' (length=15)

How can I reach real initiated front controller?

I cant pass as a parameter, because this function is used trillion times.

like image 639
nerkn Avatar asked Feb 25 '23 16:02

nerkn


1 Answers

Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
like image 131
Alex Pliutau Avatar answered Mar 08 '23 06:03

Alex Pliutau