Actually it's quite easy to change the directory layout for the views. Just
create an instance of the ViewRenderer-helper and call the
setViewScriptPathSpec method with your desired file / directory format. 

-----Ursprüngliche Nachricht-----
Von: Alan T. Miller [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 13. Juni 2007 17:55
An: [email protected]
Betreff: [fw-general] my 2 cents on views in the ZF MVC

Is it just me or is the way in which the Front Controller implements 
views going to have to change? I understand maybe there was a reason for 
making certain assumptions about how people are going to use the MVC 
framework, but I have been following this list for a few weeks now and 
it seems there are a lot of people unhappy with the way in which the 
views currently work, and it seems just as many have had problems 
implementing and understanding it.

I followed it off the documentation myself and gave it a whack and it 
stumped me for a while. It seemed there were also some 11th hour changes 
that are not so well documented which makes the whole thing confusing. I 
had just decided until this issue had been hammered out, or some better 
documentation outlining how this all works came out, I would continue 
using my own MVC style code I developed for myself, however this is not 
to say I am not excited about the possibilities with the MVC in ZF.

In my way of doing things, and maybe this is not the best way and if 
someone can enlighten me on this more, I would love to hear it, but my 
controllers basically set up everything a view needs. and then will 
inject those content variables into the view, render that view into a 
variable and then I can choose to cache it, print it to the screen or 
whatever. It appears to me that if you want to use the front controller, 
you have to basically accept the way in which the current implementation 
takes over and assumes you are printing out to the screen. But more than 
this, the current view controller assumes a directory structure for 
views that just seems excessive. I for one am not so excited about 
having to have so many nested directories for my views. As someone who 
often edits a number of template files, I can say it is a real pain in 
the ass to jump around in so many directories, when it could be just as 
easy to have implemented something where a file naming convention was 
used instead. This way you could have your views in one place?

Also, perhaps coming from using Smarty as a template engine where I 
would lay out a page using a number of nested templates and variables, I 
would welcome an example or two of how to accomplish such a feat using 
the MVC in ZF.

 

Reply via email to