> That's for include a view in another, but it's not what I want.
>
> See: I've a module named "User" with a layout. Then I have a controller
> "Index" that just print informations about the user. Now, I want to have a
> controller "Account" with some views but also with common html parts. I
> can use a specific layout for the Account controller BUT I'll have the
> header and the footer in the both layouts: if I want to change one, I'll
> have to change it into the both, that isn't really good...
>
> So, is it possible to have two layouts:
> - The first principal layout ("layout1.phml")
> - Then, at the place of the view in "layout1.phtml" the layout
> "layout2.phtml" - At the place of the view in "layout2", the view.
>
> Regards,
> Samuel.
By default the layout is a layout.phtml. Use in this layout the partial view
helper to call a header.phtml and footer.phtml view script.
Then for the account controller you can assign the account.phtml layout inside
your view by using this in your account view script:
$this->layout()->setLayout('account');
(more info: [1])
Then your account.phtml is used as layout script and you can include again the
header.phtml and footer.phtml to have consistency in those segments.
Regards, Jurian
[1]http://framework.zend.com/manual/en/zend.layout.quickstart.html#zend.layout.quickstart.mvc
--
Jurian Sluiman
Soflomo - http://soflomo.com
没有评论:
发表评论