John Jones
John Jones

Reputation: 2265

Zend Layout using different templates in different controllers

Struggling with Zend layout, I have 2 templates 1 for homepage and 1 for other pages. The layout is define in my application.ini

resources.layout.layout = "layout" resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"

The 2 template files sit it /application/layouts/scripts/

homepage.phtml layout.phtml

On the hompage controller I want to use the homepage.phtml and for the rest of the site use layout.phtml.

I have searched and search but no joy please help!

Cheers.

Upvotes: 1

Views: 690

Answers (1)

Alex Howansky
Alex Howansky

Reputation: 53563

In your homepage controller, do:

$this->_helper->layout->setLayout('homepage');

You can do this in each action, or, if you want it to fire for all actions, in the init() method.

Upvotes: 4

Related Questions