<?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: Creating a custom View Helper in the Zend Framework</title>
	<atom:link href="http://sourcecodebean.com/archives/creating-a-custom-view-helper-in-the-zend-framework/6/feed" rel="self" type="application/rss+xml" />
	<link>http://sourcecodebean.com/archives/creating-a-custom-view-helper-in-the-zend-framework/6</link>
	<description>giving you tricks and tips of good coding</description>
	<lastBuildDate>Wed, 16 Jun 2010 12:45:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Creating a JSON-RPC service using Zend Json Server</title>
		<link>http://sourcecodebean.com/archives/creating-a-custom-view-helper-in-the-zend-framework/6/comment-page-1#comment-2660</link>
		<dc:creator>Creating a JSON-RPC service using Zend Json Server</dc:creator>
		<pubDate>Thu, 07 Jan 2010 08:13:30 +0000</pubDate>
		<guid isPermaLink="false">http://sourcecodebean.com/?p=6#comment-2660</guid>
		<description>[...] Creating a custom View Helper in the Zend Framework [...]</description>
		<content:encoded><![CDATA[<p>[...] Creating a custom View Helper in the Zend Framework [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://sourcecodebean.com/archives/creating-a-custom-view-helper-in-the-zend-framework/6/comment-page-1#comment-839</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Wed, 13 May 2009 13:52:21 +0000</pubDate>
		<guid isPermaLink="false">http://sourcecodebean.com/?p=6#comment-839</guid>
		<description>Dan, 

In my project I do not store any information about the image or thumbnail path in the database. Both the originals and the thumbnails are stored on disk (not in database). The location of the image and thumbnail is determined from the type and the id of the image (a thumbnail is created on the fly if you request a size that does not exist). Therefore this is not an issue for me.

In the scenario you described, where you need to query the database to get the image path, it would make sense to store the image object somewhere - to avoid further database calls if you need the image again. If you have modeled your image class to have a Thumbnai() function, the helper method is not really needed. 


-Peter</description>
		<content:encoded><![CDATA[<p>Dan, </p>
<p>In my project I do not store any information about the image or thumbnail path in the database. Both the originals and the thumbnails are stored on disk (not in database). The location of the image and thumbnail is determined from the type and the id of the image (a thumbnail is created on the fly if you request a size that does not exist). Therefore this is not an issue for me.</p>
<p>In the scenario you described, where you need to query the database to get the image path, it would make sense to store the image object somewhere &#8211; to avoid further database calls if you need the image again. If you have modeled your image class to have a Thumbnai() function, the helper method is not really needed. </p>
<p>-Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://sourcecodebean.com/archives/creating-a-custom-view-helper-in-the-zend-framework/6/comment-page-1#comment-487</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Sun, 19 Apr 2009 17:09:38 +0000</pubDate>
		<guid isPermaLink="false">http://sourcecodebean.com/?p=6#comment-487</guid>
		<description>I was writing a view helper function to do exactly the same and came across your example. Presumably My_Model_Thumbnails will have to query the database to determine the location of original image file referenced by $id; but then by getting to this view helper, you&#039;ve probably already queried the database asking about this image.
 
So... this does seem a bit inefficient. Would an alternative be to have an image object which is populated once from the database, and then stored within the view: $this-&gt;view-&gt;image = $image within the controller. Then in the view you could call the view helper with ($image, $width, $height) instead, and it would need no further db calls.
 
But then... I&#039;m thinking: why bother with the helper function - within the view you can just do: $this-&gt;image.Thumbnail($width, $height), where Thumbnail is a method of the image object.
 
I&#039;m wondering what the best approach is, so would be interested in your comments on the above.</description>
		<content:encoded><![CDATA[<p>I was writing a view helper function to do exactly the same and came across your example. Presumably My_Model_Thumbnails will have to query the database to determine the location of original image file referenced by $id; but then by getting to this view helper, you&#8217;ve probably already queried the database asking about this image.</p>
<p>So&#8230; this does seem a bit inefficient. Would an alternative be to have an image object which is populated once from the database, and then stored within the view: $this-&gt;view-&gt;image = $image within the controller. Then in the view you could call the view helper with ($image, $width, $height) instead, and it would need no further db calls.</p>
<p>But then&#8230; I&#8217;m thinking: why bother with the helper function &#8211; within the view you can just do: $this-&gt;image.Thumbnail($width, $height), where Thumbnail is a method of the image object.</p>
<p>I&#8217;m wondering what the best approach is, so would be interested in your comments on the above.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
