2009年3月9日星期一

Re: [fw-core] Sidebar + Common elements -- How to?

Basically same thing as adding it into the registry but being able to use it inside views?

On Mon, Mar 9, 2009 at 3:10 PM, Matthew Weier O'Phinney <matthew@zend.com> wrote:
-- vadim gavrilov <vadimg88@gmail.com> wrote
(on Monday, 09 March 2009, 02:31 PM +0200):
> is there a difference using a placeholder and just the $this->view->something ?

Placeholders allow you to aggregate content in a stack, as well as
define text to prepend, append, and separate each item in the stack.
Additionally, they persist between view instances.


> On Mon, Mar 9, 2009 at 2:22 PM, Matthew Weier O'Phinney <matthew@zend.com>
> wrote:
>
>     -- Raavi Raaj <raaviraaj77@gmail.com> wrote
>     (on Monday, 09 March 2009, 12:59 PM +0530):
>     > I have 5 views which require a sidebar (out of 30 odd views). I have one
>     layout
>     > script.
>     > The sidebar content is mostly the same (except for one block which is
>     specific
>     > to the view)
>     >
>     > What is the best way to approach this (in ZF style, of course)?
>     >
>     > -------------------------------------
>     >
>     > Also, I have some HTML that I would like to include is the view based on
>     some
>     > CRITERIA. For example...
>     > HTML = If you enjoyed this article. Do consider <a href="/rss" title="RSS
>     2.0
>     > feed">subscribing to our feed</a>
>     > CRITERIA = Search visitor
>     >
>     > Now, where should I store the HTML? What is the best prtactice for common
>     > elements like these?
>     >
>     > All help is appreciated.
>
>     Typically, I recommend using the placeholder() view helper to aggregate
>     content for sidebars.
>
>     If the majority of the content is the same for those views requiring the
>     information, I'd create a view helper extending the placeholder() view
>     helper that sets up these items. Then, in your individual action view
>     scripts, you would add your additional items to the placeholder (either
>     prepending or appending to the items already contained), and then render
>     it within that view script.
>
>     --
>     Matthew Weier O'Phinney
>     Software Architect       | matthew@zend.com
>     Zend Framework           | http://framework.zend.com/
>
>
>
>
>
> --
> Vincent Gabriel.
> Lead Developer, Senior Support.
> Zend Certified Engineer.
>
>
>
>

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




--
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.




没有评论: