News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Pádraic Brady's Blog:
Complex Views with the Zend Framework - Pt 5 The Two-Step View Pattern
May 24, 2007 @ 08:43:00

Pádraic Brady is back today with the latest installment (part 5!) of his look at complex views in the Zend Framework. This time, her focuses on something called the Two-Step Pattern - a pattern similar to the Layouts pattern.

Part 5 of our series takes a small time-out from approaching a Composite View solution to reusable Views to take a peek at a simpler approach useful for simpler types of web applications. As we've discussed previously Composite Views allow the nesting of reusable View elements, effectively building a View based on a hierarchy of Views. But often there are simpler solutions to simpler problems. One such solution is the Two-Step View pattern, sometimes called Layouts if implemented in a specific way (as we do below!).

He gives the example of a simple website that needs a header and footer on every page. Rather than having to duplicate the header/footer calls across all of the pages, the Layout (Step-Two) pattern defines a single template that contains the header and footer but also uses a "main" area where the content is dynamically inserted.

He includes a full code example to help illustrate the point - a class, Zps_View, that is fed the path to the layouts and the layout files to use before rendering.

0 comments voice your opinion now!
part5 complexviews zendframework twostep designpattern layout part5 complexviews zendframework twostep designpattern layout


blog comments powered by Disqus

Similar Posts

Kevin Schroeder's Blog: Debugging an RPC call in Zend Framework

Pádraic Brady's Blog: Complex Views with the Zend Framework - Part 6: Setting The Terminology

Daniel Cousineau's Blog: Zend Framework Module Init Script (Controller Plugin)

Padraic Brady's Blog: Zend Framework Blog App Tutorial - Addendum #2: Revised Design, Date Helper

Raphael Stolt's Blog: Teaching the Zend REST server to talk JSON


Community Events











Don't see your event here?
Let us know!


install facebook support symfony2 unittest opinion composer overview language component hhvm release hack introduction application code framework package podcast security

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework