On Wed, Jun 10, 2009 at 3:23 PM, staar2 <[email protected]> wrote: > > > > Themselves wrote: > > > > Hi guys, > > > > I have a number of view scripts that are cut and paste across almost all > > of > > my view directories, basically templates that hold code to load a > > structural > > html / tabs / etc. These files are almost all identical, so there is a > > very > > obvious case for removing these duplications, along with providing an > > "override" system if and when that particular action requires custom > code. > > I've seen this page here: > > > http://joshribakoff.com/2009/02/overridable-view-scripts-in-zend-framework/- > > and it does exactly what I want, but it also seems a little bit > > curious > > having to duplicate code across all of my actions / controllers in order > > to > > remove some duplicate code. Is there a better way of doing this? > > > > > I would use here custom made view > helpers( > http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.custom > ) > and for more pure html code can be done with > partials( > http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.partial > )
View partials still need a view script there to call them - which is what I was trying to avoid. And I know you can do it with custom view helpers, except won't it ALWAYS use that "view" instead of having a default + override type functionality? Or should I work out a way to put that logic in the custom helper itself? I guess that seems clean enough...
