<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Two-Step view in Zend Framework 1.0.0</title>
	<atom:link href="http://akrabat.com/zend-framework/two-step-view-in-zf100/feed/" rel="self" type="application/rss+xml" />
	<link>http://akrabat.com/zend-framework/two-step-view-in-zf100/</link>
	<description>Developing PHP software in the Real World, by Rob Allen</description>
	<lastBuildDate>Tue, 13 Mar 2012 12:47:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Brian Reich</title>
		<link>http://akrabat.com/zend-framework/two-step-view-in-zf100/#comment-11320</link>
		<dc:creator>Brian Reich</dc:creator>
		<pubDate>Fri, 13 Jul 2007 12:14:52 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2007/07/11/two-step-view-in-zend-framework-100/#comment-11320</guid>
		<description>Here&#039;s my solution to the problem.  It&#039;s not perfect but it gets the job done. 

I override the render() method and tell it to store the script name passed as $name in the View variable $content, which is referenced in my view scripts in order to render content within an identical template across all my pages.  render() will first execute the template script, and then render the content within it when it reaches the instruction &quot;echo $this-&gt;render($this-&gt;content);&quot;.

Like I said, its not perfect but it gets the job done fast and easy.

class RC_View extends Zend_View
{
    public $template = null;
    protected $_inTemplate = false;

    public function render($name)
    {
        if($this-&gt;_template == null)
        {
            return parent::render($name);
        }
        
        
        if($this-&gt;_inTemplate)
       {                
            return parent::render($name);
        }
        else
        {
        
            $this-&gt;_inTemplate = true;
            $this-&gt;content = $name;
            $data = parent::render($this-&gt;_template);
            $this-&gt;_inTemplate = false;
            return $data;
        }
}

Note that when you create your own custom view class, you must initialize it yourself and manually register it with the ViewRenderer plug-in.</description>
		<content:encoded><![CDATA[<p>Here's my solution to the problem.  It's not perfect but it gets the job done. </p>
<p>I override the render() method and tell it to store the script name passed as $name in the View variable $content, which is referenced in my view scripts in order to render content within an identical template across all my pages.  render() will first execute the template script, and then render the content within it when it reaches the instruction "echo $this-&gt;render($this-&gt;content);".</p>
<p>Like I said, its not perfect but it gets the job done fast and easy.</p>
<p>class RC_View extends Zend_View<br />
{<br />
    public $template = null;<br />
    protected $_inTemplate = false;</p>
<p>    public function render($name)<br />
    {<br />
        if($this-&gt;_template == null)<br />
        {<br />
            return parent::render($name);<br />
        }</p>
<p>        if($this-&gt;_inTemplate)<br />
       {<br />
            return parent::render($name);<br />
        }<br />
        else<br />
        {</p>
<p>            $this-&gt;_inTemplate = true;<br />
            $this-&gt;content = $name;<br />
            $data = parent::render($this-&gt;_template);<br />
            $this-&gt;_inTemplate = false;<br />
            return $data;<br />
        }<br />
}</p>
<p>Note that when you create your own custom view class, you must initialize it yourself and manually register it with the ViewRenderer plug-in.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob...</title>
		<link>http://akrabat.com/zend-framework/two-step-view-in-zf100/#comment-11251</link>
		<dc:creator>Rob...</dc:creator>
		<pubDate>Wed, 11 Jul 2007 10:15:15 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2007/07/11/two-step-view-in-zend-framework-100/#comment-11251</guid>
		<description>Yeah :(

Should have used Trac :)

Regards,

Rob...</description>
		<content:encoded><![CDATA[<p>Yeah :(</p>
<p>Should have used Trac :)</p>
<p>Regards,</p>
<p>Rob...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Goodwin</title>
		<link>http://akrabat.com/zend-framework/two-step-view-in-zf100/#comment-11250</link>
		<dc:creator>David Goodwin</dc:creator>
		<pubDate>Wed, 11 Jul 2007 10:14:12 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2007/07/11/two-step-view-in-zend-framework-100/#comment-11250</guid>
		<description>The ZF wiki being down seems to be an unfortunate regular feature at the moment :-/</description>
		<content:encoded><![CDATA[<p>The ZF wiki being down seems to be an unfortunate regular feature at the moment :-/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob...</title>
		<link>http://akrabat.com/zend-framework/two-step-view-in-zf100/#comment-11249</link>
		<dc:creator>Rob...</dc:creator>
		<pubDate>Wed, 11 Jul 2007 10:07:03 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2007/07/11/two-step-view-in-zend-framework-100/#comment-11249</guid>
		<description>Djsv,

P&#225;draic is the author of 3, the Zend_View Enhanced proposal.

Regards,

Rob...</description>
		<content:encoded><![CDATA[<p>Djsv,</p>
<p>P&aacute;draic is the author of 3, the Zend_View Enhanced proposal.</p>
<p>Regards,</p>
<p>Rob...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: djsv</title>
		<link>http://akrabat.com/zend-framework/two-step-view-in-zf100/#comment-11248</link>
		<dc:creator>djsv</dc:creator>
		<pubDate>Wed, 11 Jul 2007 09:53:46 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/2007/07/11/two-step-view-in-zend-framework-100/#comment-11248</guid>
		<description>And what about this article? http://blog.astrumfutura.com/archives/288-Complex_Views_with_the_Zend_Framework_-_Part_5_The_Two-Step_View_Pattern.html</description>
		<content:encoded><![CDATA[<p>And what about this article? <a href="http://blog.astrumfutura.com/archives/288-Complex_Views_with_the_Zend_Framework_-_Part_5_The_Two-Step_View_Pattern.html" rel="nofollow">http://blog.astrumfutura.com/archives/288-Complex_Views_with_the_Zend_Framework_-_Part_5_The_Two-Step_View_Pattern.html</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

