2009年1月27日星期二

Re: [fw-mvc] placeholder versus $this->view->layout()

-- Ed Lazor <edlazor@internetarchitects.biz> wrote
(on Tuesday, 27 January 2009, 10:11 AM -0800):
> Is there benefit to using one of these approaches over the other from
> within an action method?
>
> $this->view->placeholder("food")->set("burrito");
>
> $this->view->layout()->food = "burrito";

Placeholders can be used as general-purpose, cross-instance storage. The
implication is that other view scripts would have access to them --
including the ability to render them. If you are stuffing things into
the layout, you're implying that the item is to be rendered *only* in
the layout script.

In point of fact, however, the two examples achieve the same end.

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: