Work with 2+ layouts on same request (ZF 1.12)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Work with 2+ layouts on same request (ZF 1.12)

Cristian Bichis-4

I have some requests where I need to work with multiple layouts.

1. Email html layout
The processing part is consisting in rendering an email_html layout +
the view (using $layout->render() ) and send it to user by email.

2. Email textlayout
There is an additional layout which is used for text version of email,

3. Frontentlayout
On frontend side there is set other layout default, which has nothing to
do with email_html layout.

Currentlyto avoid setting up per layout paths I am cloning the frontend
layout to email html and email text layouts, using something like this:

         $this->layout = clone Zend_Layout::getMvcInstance();

         $this->view = clone $this->layout->getView();

My problem is I don't know what will be a good approach so no view
helpers calls to interferwith all this layouts but rather only with
layout where they are sets. Because now if I set a let's say
$this->headStyle(some styles) this gets rendered to all 3 layouts(and
not just to email_html layout by example).