Accessing the controller's name from layout

6 messages Options
Embed this post
Permalink
Diego Potapczuk

Accessing the controller's name from layout

Reply Threaded More More options
Print post
Permalink
How can i access the controller´s name from layout?
Diego Potapczuk

Re: Accessing the controller's name from layout

Reply Threaded More More options
Print post
Permalink
How can i access the controller´s name from layout?




::: Diego Potapczuk
Alayn Gortazar

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

Reply Threaded More More options
Print post
Permalink
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
Diego Potapczuk

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

Reply Threaded More More options
Print post
Permalink
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

vtbludgeon

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

Reply Threaded More More options
Print post
Permalink
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/


umpirsky

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

Reply Threaded More More options
Print post
Permalink
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/