In View, I can get action by using
$this->action
But, I cannot get controller name by
$this->controller
What is the proper way to get current controller in View?
In View, I can get action by using
$this->action
But, I cannot get controller name by
$this->controller
What is the proper way to get current controller in View?
To get the current,
$this->params['controller']
$this->params['action']
$this->params['pass']
For cakephp 3.6 and later:
Although above solutions will work but it gives deprecated warning and will not work in cakephp 4. So It is better to use the following code to get the controller name. It will work in view page and controllers as well.