Accessing the controller's name from layout

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing the controller's name from layout

Diego Potapczuk
How can i access the controller´s name from layout?
Reply | Threaded
Open this post in threaded view
|

Re: Accessing the controller's name from layout

Diego Potapczuk
How can i access the controller´s name from layout?




::: Diego Potapczuk
Reply | Threaded
Open this post in threaded view
|

Re: Re: Accessing the controller's name from layout

Alayn Gortazar
Hi Diego,

You can get the Controllers instance with Zend_Controller_Front::getInstance(), so:

$controllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();

--
Alayn Gortazar

----- Mensaje original -----
De: "Diego Potapczuk" <[hidden email]>
Para: [hidden email]
Enviados: Miércoles, 4 de Noviembre 2009 13:04:51
Asunto: [fw-general] Re: Accessing the controller's name from layout

How can i access the controller´s name from layout?




::: Diego Potapczuk
Reply | Threaded
Open this post in threaded view
|

Re: Re: Accessing the controller's name from layout

Diego Potapczuk
Thanks


::: Diego Potapczuk


On Wed, Nov 4, 2009 at 9:31 AM, Alayn Gortazar <[hidden email]> wrote:
Hi Diego,

You can get the Controllers instance with Zend_Controller_Front::getInstance(), so:

$controllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();

--
Alayn Gortazar

----- Mensaje original -----
De: "Diego Potapczuk" <[hidden email]>
Para: [hidden email]
Enviados: Miércoles, 4 de Noviembre 2009 13:04:51
Asunto: [fw-general] Re: Accessing the controller's name from layout

How can i access the controller´s name from layout?




::: Diego Potapczuk

Reply | Threaded
Open this post in threaded view
|

Re: Re: Accessing the controller's name from layout

David Mintz
In reply to this post by Alayn Gortazar


On Wed, Nov 4, 2009 at 7:31 AM, Alayn Gortazar <[hidden email]> wrote:
Hi Diego,

You can get the Controllers instance with Zend_Controller_Front::getInstance(), so:

$controllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();



But whatever the reason for doing this, it kind of smells like a lot of PHP code for the layout layer. You might want to consider moving this logic back somewhere earlier in the request cycle.


--
Demand health care for everyone:
http://mobilizeforhealthcare.org/

--
David Mintz
http://davidmintz.org/


Reply | Threaded
Open this post in threaded view
|

Re: Re: Accessing the controller's name from layout

umpirsky
Assign it to view from controller plugin for example.

Regards,
Saša Stamenković


On Wed, Nov 4, 2009 at 5:42 PM, David Mintz <[hidden email]> wrote:


On Wed, Nov 4, 2009 at 7:31 AM, Alayn Gortazar <[hidden email]> wrote:
Hi Diego,

You can get the Controllers instance with Zend_Controller_Front::getInstance(), so:

$controllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();



But whatever the reason for doing this, it kind of smells like a lot of PHP code for the layout layer. You might want to consider moving this logic back somewhere earlier in the request cycle.


--
Demand health care for everyone:
http://mobilizeforhealthcare.org/

--
David Mintz
http://davidmintz.org/