(on Tuesday, 27 January 2009, 10:26 AM -0800):
> Which approach do you use to include content for headers, footers,
> sidebars, etc. in /application/layouts/layout.phtml?
>
> Option #1:
> Working within one action, storing content (header, footer, sidebar,
> etc.) in variables, and echoing the value of those variables in
> layout.phtml
>
> Option #2
> Forwarding ($this->_forward) from one action to another, having each
> action set the value of the layout.phtml variable that it's
> responsible for
>
> Option #3
> Using action stacks ($this->_helper->actionStack) to queue a series of
> actions, having each action set the value of the layout.phtml variable
> that it's responsible for
Option #1, only I'd extend that to using the various shipped placeholder
implementations as well as configured placeholders. Options #2 and #3
are generally inappropriate for such a task, as they are less performant
(require additional dispatch loop cycles), harder to debug, and less
intuitive (you're manipulating the view layer, not doing anything
specific to a particular controller).
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论