This is probably a newbee approach but one thing i dont understand is why in MVC, or at least, in ZF one, the view *should* be distinct for each module/controller/action ?

Say you have a site with 100 or more pages. Most of time, header, footer, etc, most of part will be the same on all pages but middle and sometime few parts like pub skyscraper, sub menu, etc. For all site, you may have about 3 distinct layouts, not much more. And also fews specific pages (no needs of layout for them). As ZF doesn't easily answer to that, there are much discussions about layouts.

Now, if you can tell which view should be used, you have not a view but a layout. In action, you just have to give data to different parts of layout that need it and what parts should be rendered in layout (eg you dont want footer or different one for a given page) . If in bootstrap, you can tell to viewRenderer the view is 'myLayout.phtml', you have set a master layout. Then, you still able to overload the master layout in controller or in action if you need sometime a different one or if you need to use a specific view.

There is almost nothing to modify to ZF to be able to do that. If viewRenderer have a function to force a view, it s quite done.

I did something like this for me, but i didn't subclass viewRenderer as ZF is still in dev. Instead, i lazy set same init function for each controllers.

This is an example of what i mean http://titerm.free.fr/ZF/samples.zip

--





---------------------------------------------------------------------
Sorry, This disclamer is auto added by my company's FW
---------------------------------------------------------------------


























Si vous n'etes pas destinataires de ce message, merci d'avertir l'expediteur de 
l'erreur de distribution et de le detruire immediatement.
Ce message contient des informations confidentielles ou appartenant a La 
Francaise des Jeux. Il est etabli a l'intention exclusive de ses destinataires. 
Toute divulgation, utilisation, diffusion ou reproduction (totale ou partielle) 
de ce message ou des informations qu'il contient, doit etre prealablement 
autorisee.
Tout message electronique est susceptible d'alteration et son integrite ne peut 
etre assuree. La Francaise des Jeux decline toute responsabilite au titre de ce 
message s'il a ete modifie ou falsifie.

If you are not the intended recipient of this e-mail, please notify the sender 
of the wrong delivery and delete it immediately from your system.
This e-mail contains confidential information or information belonging to La 
Francaise des Jeux and is intended solely for the addressees. The unauthorised 
disclosure, use, dissemination or copying (either whole or partial) of this 
e-mail, or any information it contains, is prohibited.
E-mails are susceptible to alteration and their integrity cannot be guaranteed. 
La Francaise des Jeux shall not be liable for this e-mail if modified or 
falsified.

Reply via email to