<?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: Template View and View Helper Design Patterns in PHP (updated v2)</title>
	<atom:link href="http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/</link>
	<description>A periodical blog of experiences from the angle of an autodidactic, paranoid and narcissistic web developer...</description>
	<lastBuildDate>Thu, 04 Mar 2010 21:21:10 +1100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<meta xmlns="http://www.w3.org/1999/xhtml" name="robots" content="noindex,follow" />
	<item>
		<title>By: rvdavid</title>
		<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/#comment-1513</link>
		<dc:creator>rvdavid</dc:creator>
		<pubDate>Wed, 24 Feb 2010 10:41:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.rvdavid.net/blog/template-view-and-view-helper-flock-together/#comment-1513</guid>
		<description>Sorry you&#039;ve had so much trouble using the example code.

Firstly, you are getting the error because the memory limit is set to 32M - look for memory_limit in your php.ini file and change it to something like 128M. 

From reading your comments, it looks like you&#039;re making the transition from procedural to OOP.

When you become more experienced with OOP, you&#039;ll look at the code snippets here and you&#039;ll hate it. 

Use the examples and concepts presented here, to familiarise yourself with OOP (using classes / objects) rather than a recipe to building web apps / sites. 

In addition, this is a very old post (3 years old!) Since then, a lot of frameworks have matured and are production ready. 

I highly recommend that you pick one up. 

I&#039;m using Zend Framework (http://framework.zend.com), have successfully built 3 web applications on it,  and I am very happy with the results.

Good luck with your project.</description>
		<content:encoded><![CDATA[<p>Sorry you&#8217;ve had so much trouble using the example code.</p>
<p>Firstly, you are getting the error because the memory limit is set to 32M &#8211; look for memory_limit in your php.ini file and change it to something like 128M. </p>
<p>From reading your comments, it looks like you&#8217;re making the transition from procedural to OOP.</p>
<p>When you become more experienced with OOP, you&#8217;ll look at the code snippets here and you&#8217;ll hate it. </p>
<p>Use the examples and concepts presented here, to familiarise yourself with OOP (using classes / objects) rather than a recipe to building web apps / sites. </p>
<p>In addition, this is a very old post (3 years old!) Since then, a lot of frameworks have matured and are production ready. </p>
<p>I highly recommend that you pick one up. </p>
<p>I&#8217;m using Zend Framework (<a href="http://framework.zend.com" rel="nofollow">http://framework.zend.com</a>), have successfully built 3 web applications on it,  and I am very happy with the results.</p>
<p>Good luck with your project.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: San</title>
		<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/#comment-1512</link>
		<dc:creator>San</dc:creator>
		<pubDate>Wed, 24 Feb 2010 07:04:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.rvdavid.net/blog/template-view-and-view-helper-flock-together/#comment-1512</guid>
		<description>Hello ,
  I tried to make it work like the following, but I got the error!:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 33292271 bytes) in C:\xampp\htdocs\view\NewsViewHelper.class.php on line 23


require_once(&#039;ViewHelperLocator.class.php&#039;);
	require_once(&#039;View.class.php&#039;);
	
	$connection = mysql_connect(&#039;localhost&#039;, &#039;root&#039;, &#039;&#039;);
	mysql_select_db(&#039;floorplans&#039;, $connection); 
	
	$viewHelperLocator = new ViewHelperLocator($connection);
	$view = new View($viewHelperLocator, &#039;template.php&#039;);	
	$view-&gt;render();

I&#039;m interested in this code working, I want to create site without any framework, but similar code!
:-)
San.</description>
		<content:encoded><![CDATA[<p>Hello ,<br />
  I tried to make it work like the following, but I got the error!:<br />
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 33292271 bytes) in C:\xampp\htdocs\view\NewsViewHelper.class.php on line 23</p>
<p>require_once(&#8216;ViewHelperLocator.class.php&#8217;);<br />
	require_once(&#8216;View.class.php&#8217;);</p>
<p>	$connection = mysql_connect(&#8216;localhost&#8217;, &#8216;root&#8217;, &#8221;);<br />
	mysql_select_db(&#8216;floorplans&#8217;, $connection); </p>
<p>	$viewHelperLocator = new ViewHelperLocator($connection);<br />
	$view = new View($viewHelperLocator, &#8216;template.php&#8217;);<br />
	$view-&gt;render();</p>
<p>I&#8217;m interested in this code working, I want to create site without any framework, but similar code!<br />
 <img src='http://www.rvdavid.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
San.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: San</title>
		<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/#comment-1511</link>
		<dc:creator>San</dc:creator>
		<pubDate>Wed, 24 Feb 2010 06:57:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.rvdavid.net/blog/template-view-and-view-helper-flock-together/#comment-1511</guid>
		<description>class :ViewHelperLocator
Function : getHelper($helper)

Typos: return $this-&gt;cache[$helper]; (underscore is missing for cache)

this took my time :-)</description>
		<content:encoded><![CDATA[<p>class :ViewHelperLocator<br />
Function : getHelper($helper)</p>
<p>Typos: return $this-&gt;cache[$helper]; (underscore is missing for cache)</p>
<p>this took my time <img src='http://www.rvdavid.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: San</title>
		<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/#comment-1510</link>
		<dc:creator>San</dc:creator>
		<pubDate>Wed, 24 Feb 2010 05:43:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.rvdavid.net/blog/template-view-and-view-helper-flock-together/#comment-1510</guid>
		<description>Hi, 
   Could you please include the code to call this View from a page? if you have working code that will be better.
Regards,
San.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
   Could you please include the code to call this View from a page? if you have working code that will be better.<br />
Regards,<br />
San.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rvdavid</title>
		<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/#comment-221</link>
		<dc:creator>rvdavid</dc:creator>
		<pubDate>Tue, 23 Oct 2007 12:10:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.rvdavid.net/blog/template-view-and-view-helper-flock-together/#comment-221</guid>
		<description>No problems. If you have any problems you can always contact me through the contact form on this site.

Regards, 


R. Villar David</description>
		<content:encoded><![CDATA[<p>No problems. If you have any problems you can always contact me through the contact form on this site.</p>
<p>Regards, </p>
<p>R. Villar David</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/#comment-218</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Sat, 13 Oct 2007 20:14:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.rvdavid.net/blog/template-view-and-view-helper-flock-together/#comment-218</guid>
		<description>thanks :) now its a little bit clearer, but i have to study other  patterns to comprehend it as a whole. ill check registry pattern first, good work</description>
		<content:encoded><![CDATA[<p>thanks <img src='http://www.rvdavid.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  now its a little bit clearer, but i have to study other  patterns to comprehend it as a whole. ill check registry pattern first, good work</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rvdavid</title>
		<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/#comment-209</link>
		<dc:creator>rvdavid</dc:creator>
		<pubDate>Tue, 09 Oct 2007 23:23:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.rvdavid.net/blog/template-view-and-view-helper-flock-together/#comment-209</guid>
		<description>Hi Frank, 

No recursion occurs here at all, I think the source of your confusion is that you are thinking that the &quot;getHelper()&quot; method in the Generic View and the &quot;getHelper()&quot; method in the locator are coming from the same object. They most certainly are not. What&#039;s happening here is that I have encapsulated the call to $this-&gt;_locator-&gt;getHelper() with a method within the Generic View, so that I won&#039;t have to type in $this-&gt;_locator-&gt;getHelper() all the time. The &quot;getHelper&quot; method in the view object is merely for convenience.

The $locator variable is actually another object called &quot;Service Locator&quot; that handles object creation for you and holds instances of classes made before hand. A Service Locator is just like a registry but knows how to create objects (factory). So if in the example above, I use a Service Locator which knows exactly what a View Helper needs to be instantiated and caches it for later use.

I&#039;ll update the example above for you to make it a little clearer. 


Regards,


R. Villar David.</description>
		<content:encoded><![CDATA[<p>Hi Frank, </p>
<p>No recursion occurs here at all, I think the source of your confusion is that you are thinking that the &#8220;getHelper()&#8221; method in the Generic View and the &#8220;getHelper()&#8221; method in the locator are coming from the same object. They most certainly are not. What&#8217;s happening here is that I have encapsulated the call to $this->_locator->getHelper() with a method within the Generic View, so that I won&#8217;t have to type in $this->_locator->getHelper() all the time. The &#8220;getHelper&#8221; method in the view object is merely for convenience.</p>
<p>The $locator variable is actually another object called &#8220;Service Locator&#8221; that handles object creation for you and holds instances of classes made before hand. A Service Locator is just like a registry but knows how to create objects (factory). So if in the example above, I use a Service Locator which knows exactly what a View Helper needs to be instantiated and caches it for later use.</p>
<p>I&#8217;ll update the example above for you to make it a little clearer. </p>
<p>Regards,</p>
<p>R. Villar David.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/#comment-207</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Tue, 09 Oct 2007 09:31:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.rvdavid.net/blog/template-view-and-view-helper-flock-together/#comment-207</guid>
		<description>doesnt it go recursive, when i call get getHelper on locator and i supposed locator to be the the class viewer itself, what is to be stored in locator variable? which object i call with $this-&gt;_locater, the viewer object? and where is template view code stored in? 
thanks in advance</description>
		<content:encoded><![CDATA[<p>doesnt it go recursive, when i call get getHelper on locator and i supposed locator to be the the class viewer itself, what is to be stored in locator variable? which object i call with $this-&gt;_locater, the viewer object? and where is template view code stored in?<br />
thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rvdavid</title>
		<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/#comment-146</link>
		<dc:creator>rvdavid</dc:creator>
		<pubDate>Tue, 11 Sep 2007 15:05:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.rvdavid.net/blog/template-view-and-view-helper-flock-together/#comment-146</guid>
		<description>Thank you in turn for the feedback.</description>
		<content:encoded><![CDATA[<p>Thank you in turn for the feedback.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sopitikoj</title>
		<link>http://www.rvdavid.net/template-view-and-view-helper-design-patterns-in-php/#comment-145</link>
		<dc:creator>sopitikoj</dc:creator>
		<pubDate>Sat, 08 Sep 2007 03:16:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.rvdavid.net/blog/template-view-and-view-helper-flock-together/#comment-145</guid>
		<description>Hello 
 
At you the excellent site, a lot of useful info and good design, thank.
 
 
Bye</description>
		<content:encoded><![CDATA[<p>Hello </p>
<p>At you the excellent site, a lot of useful info and good design, thank.</p>
<p>Bye</p>
]]></content:encoded>
	</item>
</channel>
</rss>
