<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Zendcasts Forum / ZC32 - Custom Action Helpers for Firebug]]></title>
		<link>http://www.zendcasts.com/forum/viewtopic.php?id=39</link>
		<description><![CDATA[The most recent posts in ZC32 - Custom Action Helpers for Firebug.]]></description>
		<lastBuildDate>Wed, 20 Jan 2010 10:59:34 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: ZC32 - Custom Action Helpers for Firebug]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=563#p563</link>
			<description><![CDATA[<p>i personally like a lot your english accent with french influences </p><p>especially i like at the beginning of the videos when you pronounce your name (i never understand it:)</p>]]></description>
			<author><![CDATA[dummy@example.com (muscailie)]]></author>
			<pubDate>Wed, 20 Jan 2010 10:59:34 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=563#p563</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC32 - Custom Action Helpers for Firebug]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=167#p167</link>
			<description><![CDATA[<p>its really good idea to use phpdoc blocks to control your code <br />frankly for me i had never think to use it like this <br />thanks for sharing jon <img src="http://www.zendcasts.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (tawfekov)]]></author>
			<pubDate>Tue, 08 Sep 2009 22:34:52 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=167#p167</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC32 - Custom Action Helpers for Firebug]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=166#p166</link>
			<description><![CDATA[<p>That&#039;s clever, thanks for sharing. I&#039;m disciplined with doc blocks so this fits in nicely with my style. Very cool.</p>]]></description>
			<author><![CDATA[dummy@example.com (ryan.horn)]]></author>
			<pubDate>Tue, 08 Sep 2009 16:18:42 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=166#p166</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC32 - Custom Action Helpers for Firebug]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=165#p165</link>
			<description><![CDATA[<p>I had the opportunity to work with <a href="http://www.maximebf.com">Maxime Bouroumeau-Fuseau</a> on a project recently and he contributed this ActionHelper, which is my personal favourite way of handling this kind of problem. Maxime has a knack for leveraging PHPDoc comments (notice the @ajax detection in the preDispatch). It reminds me of Attributes in C#:</p><p>[code=php]<br />&lt;?php</p><p>/**<br /> * If a controller action has the @ajax tag in its doc comment, then<br /> * the output will be a json string of the controller&#039;s json property<br /> */<br />class App_Controller_Action_Helper_Ajax extends Zend_Controller_Action_Helper_Abstract<br />{<br />&#160; &#160; /**<br />&#160; &#160;&#160; * @var bool<br />&#160; &#160;&#160; */<br />&#160; &#160; protected $_isAjax = false;<br />&#160; &#160; <br />&#160; &#160; /**<br />&#160; &#160;&#160; * (non-PHPdoc)<br />&#160; &#160;&#160; * @see library/Zend/Controller/Action/Helper/Zend_Controller_Action_Helper_Abstract#preDispatch()<br />&#160; &#160;&#160; */<br />&#160; &#160; public function preDispatch()<br />&#160; &#160; {<br />&#160; &#160; &#160; &#160; $this-&gt;_isAjax = false;<br />&#160; &#160; &#160; &#160; $controller = $this-&gt;getActionController();<br />&#160; &#160; &#160; &#160; $action = $this-&gt;getRequest()-&gt;getActionName();<br />&#160; &#160; &#160; &#160; $methodName = $action . &#039;Action&#039;;<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; if (!method_exists($controller, $methodName)) {<br />&#160; &#160; &#160; &#160; &#160; &#160; return;<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; $class = new ReflectionClass(get_class($controller));<br />&#160; &#160; &#160; &#160; $method = $class-&gt;getMethod($methodName);<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; if (!preg_match(&#039;/@ajax/&#039;, $method-&gt;getDocComment())) {<br />&#160; &#160; &#160; &#160; &#160; &#160; return;<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; $this-&gt;_isAjax = true;<br />&#160; &#160; &#160; &#160; $controller-&gt;getHelper(&#039;layout&#039;)-&gt;disableLayout();<br />&#160; &#160; }<br />&#160; &#160; <br />&#160; &#160; /**<br />&#160; &#160;&#160; * (non-PHPdoc)<br />&#160; &#160;&#160; * @see library/Zend/Controller/Action/Helper/Zend_Controller_Action_Helper_Abstract#postDispatch()<br />&#160; &#160;&#160; */<br />&#160; &#160; public function postDispatch()<br />&#160; &#160; {<br />&#160; &#160; &#160; &#160; if (!$this-&gt;_isAjax || !isset($this-&gt;getActionController()-&gt;json)) {<br />&#160; &#160; &#160; &#160; &#160; &#160; return;<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; $json = $this-&gt;getActionController()-&gt;json;<br />&#160; &#160; &#160; &#160; if (!is_string($json)) {<br />&#160; &#160; &#160; &#160; &#160; &#160; $json = Zend_Json::encode($json);<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; $this-&gt;getActionController()-&gt;getHelper(&#039;viewRenderer&#039;)-&gt;setNoRender();<br />&#160; &#160; &#160; &#160; header(&#039;Content-type: application/json&#039;);<br />&#160; &#160; &#160; &#160; echo $json;<br />&#160; &#160; }<br />}<br />[/code]</p>]]></description>
			<author><![CDATA[dummy@example.com (Jon Lebensold)]]></author>
			<pubDate>Tue, 08 Sep 2009 15:55:16 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=165#p165</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC32 - Custom Action Helpers for Firebug]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=164#p164</link>
			<description><![CDATA[<p>By the way, my registration email was auto flagged as spam in gmail, FYI.</p>]]></description>
			<author><![CDATA[dummy@example.com (ryan.horn)]]></author>
			<pubDate>Tue, 08 Sep 2009 14:42:27 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=164#p164</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC32 - Custom Action Helpers for Firebug]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=163#p163</link>
			<description><![CDATA[<p>First off, thanks for the screen casts. I found the site recently and they&#039;ve been helpful thus far (I&#039;m somewhat new to Zend, but come from other frameworks).</p><p>My only comment right now would be that I don&#039;t like holding the individual action methods responsible for disabling the layout, flagging the view renderer, etc. Instead I put that logic in the post dispatch hook and set a flag in each action which should return a JSON response.</p><p>ex:</p><div class="codebox"><pre><code>public function jsonAction() {
    $this-&gt;_isJsonRequest = TRUE;
    ...
}

public function postDispatch() {
    if ($this-&gt;_isJsonRequest === TRUE) {
        $this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender(TRUE);
        $this-&gt;_helper-&gt;getHelper(&#039;layout&#039;)-&gt;disableLayout();
        // Anything else that needs to happen in an action returning a JSON response
    }
}</code></pre></div><br /><p>Not sure if this is the best way, but that&#039;s how I&#039;m doing it. Could probably get more fancy by detecting AJAX requests via the headers sent rather than having to set a flag manually, but maybe another day.</p>]]></description>
			<author><![CDATA[dummy@example.com (ryan.horn)]]></author>
			<pubDate>Tue, 08 Sep 2009 14:16:05 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=163#p163</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC32 - Custom Action Helpers for Firebug]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=143#p143</link>
			<description><![CDATA[<p>hey sNop&#160; , <br />This is me tawfek and i would like to thank you for your positive criticism <br />and as Jon Said If you&#039;re not a fan of my voice, My video&#160; ,&#160; simply download the project file .<br />if you are really happy with zendcasts vedio&#160; you should really re think how to spread it the world , aren&#039;t you ??<br />Jon &amp; I hope you find this site informative </p><p>Jon , <br />Thank you very much , i am really appreciate it<br />very much <img src="http://www.zendcasts.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /> <br />tawfek</p>]]></description>
			<author><![CDATA[dummy@example.com (tawfekov)]]></author>
			<pubDate>Wed, 02 Sep 2009 09:16:25 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=143#p143</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC32 - Custom Action Helpers for Firebug]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=135#p135</link>
			<description><![CDATA[<p>Hey sNop,</p><p>Thanks for the feedback! Personally, I think that Tawfek&#039;s contributions to Zendcasts are great. While his English isn&#039;t perfect, I think that first and foremost, this is a learning portal and if he can come and do 3 videos about the Zend Framework (in comparison to the 30 that are done by myself, a native English speaker), it helps enrich the overall content of the site. </p><p>Furthermore, the topics he covers are areas that he obviously demonstrates competency. If you&#039;re not a fan of his voice, simply download the project file. </p><p>When I do my own videos, I have two monitors so that the code I&#039;m writing has already been written and I&#039;m literally transcribing it (that&#039;s why I look like I never make mistakes, something that&#039;s very far from the truth.)</p><p>I hope you enjoy the video that was posted today. </p><p>Best,<br />-<br />Jon Lebensold</p>]]></description>
			<author><![CDATA[dummy@example.com (Jon Lebensold)]]></author>
			<pubDate>Tue, 01 Sep 2009 17:24:07 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=135#p135</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC32 - Custom Action Helpers for Firebug]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=133#p133</link>
			<description><![CDATA[<p>Hi,</p><p>I like your videos, but what bothers me is that you do errors in each word as you write, if you doesn&#039;t have any physical handicap (in this case ignore this part), so pls try to focus on it.</p><p>The other stuff is that your english isn&#039;t good, but this doesn&#039;t bother me because your english is understandable and i&#039;m very happy for every video you post, because In every video i discover something.</p><p>This post is intended as a positive criticism and I don&#039;t want to offend you. <img src="http://www.zendcasts.com/forum/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>So i want to thank you for your videos and I look forward to more videos.</p><p>Have i nice day.</p>]]></description>
			<author><![CDATA[dummy@example.com (sNop)]]></author>
			<pubDate>Tue, 01 Sep 2009 10:29:30 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=133#p133</guid>
		</item>
		<item>
			<title><![CDATA[ZC32 - Custom Action Helpers for Firebug]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=109#p109</link>
			<description><![CDATA[<p>I&#039;d like to introduce Tawfek&#039;s sequel to his video covering Debugging in Firebug with the Zend Framework. If you&#039;re looking for a tutorial on how to write a custom Action Helper, or wishing to make your ajax development more robust with logging and profiling, then these 33 minutes will save you a pile of googling.</p><h5>Topics Covered</h5><ul><li><p>Review of firebug</p></li><li><p><strong>2:00:</strong> writing a custom Action Helper</p></li><li><p><strong>5:30:</strong> configuring the Zend Bootstrap</p></li><li><p><strong>10:00:</strong> Testing the Action Helper Through Firebug</p></li><li><p><strong>12:30:</strong> Writing magic methods</p></li><li><p><strong>16:00:</strong> Setting up a JSON-friendly view</p></li><li><p><strong>18:00:</strong> Integrating Zend_Db</p></li><li><p><strong>26:00:</strong> Implementing jQuery</p></li><li><p><strong>29:00:</strong> Console Logging with Firebug and jQuery</p></li></ul>]]></description>
			<author><![CDATA[dummy@example.com (Jon Lebensold)]]></author>
			<pubDate>Sun, 23 Aug 2009 01:18:20 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=109#p109</guid>
		</item>
	</channel>
</rss>

