<?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: Determining if a ZF view helper exists</title>
	<atom:link href="http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/feed/" rel="self" type="application/rss+xml" />
	<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/</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: Rob...</title>
		<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/#comment-30261</link>
		<dc:creator>Rob...</dc:creator>
		<pubDate>Wed, 20 Jan 2010 22:48:33 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=900#comment-30261</guid>
		<description>Slavi,

I suspect that you&#039;d need to extend Zend_View to do that.

Dynamically generated view helpers is a good use-case :)  In reality though, I was chatting with &lt;a href=&quot;http://twitter.com/phpcodemonkey&quot; rel=&quot;nofollow&quot;&gt;Jeremy&lt;/a&gt; on IRC and helped him solved his problem :)

Regards,

Rob...</description>
		<content:encoded><![CDATA[<p>Slavi,</p>
<p>I suspect that you'd need to extend Zend_View to do that.</p>
<p>Dynamically generated view helpers is a good use-case :)  In reality though, I was chatting with <a href="http://twitter.com/phpcodemonkey" rel="nofollow">Jeremy</a> on IRC and helped him solved his problem :)</p>
<p>Regards,</p>
<p>Rob...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Slavi</title>
		<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/#comment-30260</link>
		<dc:creator>Slavi</dc:creator>
		<pubDate>Wed, 20 Jan 2010 22:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=900#comment-30260</guid>
		<description>is there a way to make the a catch-all view helper that handles calls to non-existent view helpers ?
maybe replace it with HTML comments if not found.

e.g. &lt;!-- [SomeNonExistenHelper: error processing this directive] --&gt;

Maybe Rob was checking for view helper existence is because he&#039;s dynamically generating the helper names ?
Am I right Rob ?

Slavi</description>
		<content:encoded><![CDATA[<p>is there a way to make the a catch-all view helper that handles calls to non-existent view helpers ?<br />
maybe replace it with HTML comments if not found.</p>
<p>e.g. <!-- [SomeNonExistenHelper: error processing this directive] --></p>
<p>Maybe Rob was checking for view helper existence is because he's dynamically generating the helper names ?<br />
Am I right Rob ?</p>
<p>Slavi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: iSac</title>
		<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/#comment-30243</link>
		<dc:creator>iSac</dc:creator>
		<pubDate>Wed, 20 Jan 2010 08:33:10 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=900#comment-30243</guid>
		<description>I actually have a use for it. I have a Mootools library where setOption($key, $value) checks if $key ends in &#039;Options&#039; and $value is an array. If so it looks to see if there is a widget with the name $key: if so it calls setOptions($value) on it; if not it sets the option as usual.

i.e.
$ajaxHelper = $this-&gt;ajaxSubmission();
$ajaxHelper-&gt;setOption(&#039;waiterOptions&#039;, array(&#039;message&#039; =&gt; &#039;Please Wait&#039;, &#039;color&#039; =&gt; &#039;blue&#039;, &#039;et&#039; =&gt; &#039;cetera&#039;));

The second line will call the setOptions method of the Waiter helper if it exists, and if not just encodes it as usual. If it does exist this allows the &quot;target widget&quot; (waiter in this case) to do anything special it needs to with a particular waiter option.

Thanks Rob!</description>
		<content:encoded><![CDATA[<p>I actually have a use for it. I have a Mootools library where setOption($key, $value) checks if $key ends in 'Options' and $value is an array. If so it looks to see if there is a widget with the name $key: if so it calls setOptions($value) on it; if not it sets the option as usual.</p>
<p>i.e.<br />
$ajaxHelper = $this-&gt;ajaxSubmission();<br />
$ajaxHelper-&gt;setOption('waiterOptions', array('message' =&gt; 'Please Wait', 'color' =&gt; 'blue', 'et' =&gt; 'cetera'));</p>
<p>The second line will call the setOptions method of the Waiter helper if it exists, and if not just encodes it as usual. If it does exist this allows the "target widget" (waiter in this case) to do anything special it needs to with a particular waiter option.</p>
<p>Thanks Rob!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Ribakoff</title>
		<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/#comment-30195</link>
		<dc:creator>Josh Ribakoff</dc:creator>
		<pubDate>Mon, 18 Jan 2010 03:54:03 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=900#comment-30195</guid>
		<description>Cool but don&#039;t see the use either. Just try and use it. The exception itself is enough to tell you it doesn&#039;t exist. It also nicely prints out the helper paths that it looked in, if you noticed.</description>
		<content:encoded><![CDATA[<p>Cool but don't see the use either. Just try and use it. The exception itself is enough to tell you it doesn't exist. It also nicely prints out the helper paths that it looked in, if you noticed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gregor</title>
		<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/#comment-30166</link>
		<dc:creator>gregor</dc:creator>
		<pubDate>Fri, 15 Jan 2010 23:28:09 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=900#comment-30166</guid>
		<description>why should i do that?</description>
		<content:encoded><![CDATA[<p>why should i do that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chancegarcia</title>
		<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/#comment-30139</link>
		<dc:creator>chancegarcia</dc:creator>
		<pubDate>Thu, 14 Jan 2010 21:25:54 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=900#comment-30139</guid>
		<description>If it throws an exception, shouldn&#039;t you just use a try-catch block? Seems to me that this solution may run into an issue if the helperExists() helper doesn&#039;t exist.

Assuming $this is the view object:

try {
$this-&gt;foo();
} catch (Zend_Loader_PluginLoader_Exception $zlpe){
echo &quot;oh noes foo helper is missing&quot;;
}</description>
		<content:encoded><![CDATA[<p>If it throws an exception, shouldn't you just use a try-catch block? Seems to me that this solution may run into an issue if the helperExists() helper doesn't exist.</p>
<p>Assuming $this is the view object:</p>
<p>try {<br />
$this-&gt;foo();<br />
} catch (Zend_Loader_PluginLoader_Exception $zlpe){<br />
echo "oh noes foo helper is missing";<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chancegarcia</title>
		<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/#comment-30138</link>
		<dc:creator>chancegarcia</dc:creator>
		<pubDate>Thu, 14 Jan 2010 21:06:21 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=900#comment-30138</guid>
		<description>phpcodemonkey: if it throws an exception, that says to me the helper execution should be in a try-catch and handled that way. 

Bonaparte makes a good point, why do you need to check for a helpers existence then conditionally call it. The way I see it, if I&#039;m calling a helper, then I need it to exist. If it doesn&#039;t exist, that&#039;s an error condition that should be handled. Besides, if the helperExists helper doesn&#039;t exist, you&#039;re back at square one.</description>
		<content:encoded><![CDATA[<p>phpcodemonkey: if it throws an exception, that says to me the helper execution should be in a try-catch and handled that way. </p>
<p>Bonaparte makes a good point, why do you need to check for a helpers existence then conditionally call it. The way I see it, if I'm calling a helper, then I need it to exist. If it doesn't exist, that's an error condition that should be handled. Besides, if the helperExists helper doesn't exist, you're back at square one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bonaparte</title>
		<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/#comment-30097</link>
		<dc:creator>Bonaparte</dc:creator>
		<pubDate>Tue, 12 Jan 2010 19:01:52 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=900#comment-30097</guid>
		<description>Never had to check whether a view helper exists. 

I&#039;m wondering why would anyone want to check if a view helper exists and conditionally call the view helper. :/</description>
		<content:encoded><![CDATA[<p>Never had to check whether a view helper exists. </p>
<p>I'm wondering why would anyone want to check if a view helper exists and conditionally call the view helper. :/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phpcodemonkey</title>
		<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/#comment-30096</link>
		<dc:creator>phpcodemonkey</dc:creator>
		<pubDate>Tue, 12 Jan 2010 18:42:20 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=900#comment-30096</guid>
		<description>Mathew, we tried that and it throws an exception, hence this code was discussed and worked out in #phpnw IRC following my initial question. Thanks @akrabat :)</description>
		<content:encoded><![CDATA[<p>Mathew, we tried that and it throws an exception, hence this code was discussed and worked out in #phpnw IRC following my initial question. Thanks @akrabat :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: umpirsky</title>
		<link>http://akrabat.com/zend-framework/determining-if-a-zf-view-helper-exists/#comment-30095</link>
		<dc:creator>umpirsky</dc:creator>
		<pubDate>Tue, 12 Jan 2010 18:27:58 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=900#comment-30095</guid>
		<description>Keep on writing good posts!</description>
		<content:encoded><![CDATA[<p>Keep on writing good posts!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

