<?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: How to use a helper in a controller</title>
	<atom:link href="http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Thu, 11 Mar 2010 15:41:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/comment-page-1/#comment-127194</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Wed, 06 May 2009 14:20:47 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/#comment-127194</guid>
		<description>@Brian: I&#039;m glad to hear this article was helpful for you!</description>
		<content:encoded><![CDATA[<p>@Brian: I&#8217;m glad to hear this article was helpful for you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Henk</title>
		<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/comment-page-1/#comment-127138</link>
		<dc:creator>Brian Henk</dc:creator>
		<pubDate>Tue, 05 May 2009 19:56:12 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/#comment-127138</guid>
		<description>Thanks again for the help. I agree with the original premise of helpers though - you shouldn&#039;t be doing anything that the user sees in the controller (at least not finally).

The problem for me came in the form of AJAX requests, which forwarded some controller generated JSON.</description>
		<content:encoded><![CDATA[<p>Thanks again for the help. I agree with the original premise of helpers though &#8211; you shouldn&#8217;t be doing anything that the user sees in the controller (at least not finally).</p>
<p>The problem for me came in the form of AJAX requests, which forwarded some controller generated JSON.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/comment-page-1/#comment-115754</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Fri, 26 Dec 2008 09:50:54 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/#comment-115754</guid>
		<description>@rrd: Thanks for the link!</description>
		<content:encoded><![CDATA[<p>@rrd: Thanks for the link!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rrd</title>
		<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/comment-page-1/#comment-115677</link>
		<dc:creator>rrd</dc:creator>
		<pubDate>Thu, 25 Dec 2008 17:01:46 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/#comment-115677</guid>
		<description>for the english version check this link:
http://translate.google.com/translate?hl=en&amp;u=http%3A%2F%2Fm3nt0r.de%2Fblog%2F2007%2F08%2F12%2Fcakephp-helpercomponent%2F&amp;sl=de&amp;tl=en</description>
		<content:encoded><![CDATA[<p>for the english version check this link:<br />
<a href="http://translate.google.com/translate?hl=en&amp;u=http%3A%2F%2Fm3nt0r.de%2Fblog%2F2007%2F08%2F12%2Fcakephp-helpercomponent%2F&amp;sl=de&amp;tl=en" rel="nofollow">http://translate.google.com/translate?hl=en&amp;u=http%3A%2F%2Fm3nt0r.de%2Fblog%2F2007%2F08%2F12%2Fcakephp-helpercomponent%2F&amp;sl=de&amp;tl=en</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/comment-page-1/#comment-101757</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 07 Aug 2008 15:29:21 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/#comment-101757</guid>
		<description>@maulana: Cool to hear that :)  And yes, it would be useful to have global helpers.

Just curious, is your CMS realized with Cake?</description>
		<content:encoded><![CDATA[<p>@maulana: Cool to hear that :)  And yes, it would be useful to have global helpers.</p>
<p>Just curious, is your CMS realized with Cake?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maulana</title>
		<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/comment-page-1/#comment-101725</link>
		<dc:creator>maulana</dc:creator>
		<pubDate>Thu, 07 Aug 2008 04:27:10 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/#comment-101725</guid>
		<description>Damn, you save my life with this article, and I agree with bparise, global helper will be very helpful. Thanks Daniel</description>
		<content:encoded><![CDATA[<p>Damn, you save my life with this article, and I agree with bparise, global helper will be very helpful. Thanks Daniel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/comment-page-1/#comment-93426</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Sat, 07 Jun 2008 13:31:55 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/#comment-93426</guid>
		<description>@mjamesd: Thanks for the hint, it is now fixed in the article!</description>
		<content:encoded><![CDATA[<p>@mjamesd: Thanks for the hint, it is now fixed in the article!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mjamesd</title>
		<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/comment-page-1/#comment-92786</link>
		<dc:creator>mjamesd</dc:creator>
		<pubDate>Wed, 04 Jun 2008 15:44:22 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/#comment-92786</guid>
		<description>In CakePHP 1.2, &quot;loadHelper(&#039;NameOfHelper&#039;)&quot; is depreciated. Use &quot;App::import(&#039;Helper&#039;,&#039;NameOfHelper&#039;)&quot; instead.</description>
		<content:encoded><![CDATA[<p>In CakePHP 1.2, &#8220;loadHelper(&#8216;NameOfHelper&#8217;)&#8221; is depreciated. Use &#8220;App::import(&#8216;Helper&#8217;,'NameOfHelper&#8217;)&#8221; instead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/comment-page-1/#comment-10731</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Sat, 18 Aug 2007 06:43:39 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/#comment-10731</guid>
		<description>@Yevgeny: Yes, that&#039;s a possible solution to avoid creating too many very simple views. 

Personally, I have used a different approach to avoid such views. I created a one simple view with only one statement:
&lt;pre&gt;
&lt;?php echo $text; ?&gt;
&lt;/pre&gt;
This view I rendered then from all places where I needed such a simple view.</description>
		<content:encoded><![CDATA[<p>@Yevgeny: Yes, that&#8217;s a possible solution to avoid creating too many very simple views. </p>
<p>Personally, I have used a different approach to avoid such views. I created a one simple view with only one statement:</p>
<pre>
&lt;?php echo $text; ?&gt;
</pre>
<p>This view I rendered then from all places where I needed such a simple view.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yevgeny Tomenko</title>
		<link>http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/comment-page-1/#comment-10704</link>
		<dc:creator>Yevgeny Tomenko</dc:creator>
		<pubDate>Thu, 16 Aug 2007 08:36:55 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/08/09/how-to-use-a-helper-in-a-controller/#comment-10704</guid>
		<description>@cakebaker,
You does not disturb when you use $this-&gt;Session-&gt;setFlash in your controller.
For example you write ajax driven application and one of your action just doing something and without refresh screen show text result. Will you create view with two line of code
replace_html(&#039;#message&#039;,$message); ?&gt;
effect(&#039;#message&#039;,&#039;Highlight&#039;,array(&#039;duration&#039;=&gt;2, &#039;startcolor&#039;=&gt;&#039;#7777ff&#039;)); ?&gt;

and use $this-&gt;set(&#039;message&#039;, __(&#039;some_msg&#039;,true)); in your controller.
And if you have many such views  you will not DRY.
But you can create helper Msg with function 
showMessage ($message) {
$this-&gt;Page-&gt;replace_html(&#039;#message&#039;,$message); ?&gt;
$this-&gt;Page-&gt;effect(&#039;#message&#039;,&#039;Highlight&#039;,array(&#039;duration&#039;=&gt;2, &#039;startcolor&#039;=&gt;&#039;#7777ff&#039;));
}
and use this helper from controller like this:
$this-&gt;Msg-&gt;showMessage(&#039;ok&#039;);
exit;</description>
		<content:encoded><![CDATA[<p>@cakebaker,<br />
You does not disturb when you use $this-&gt;Session-&gt;setFlash in your controller.<br />
For example you write ajax driven application and one of your action just doing something and without refresh screen show text result. Will you create view with two line of code<br />
replace_html(&#8216;#message&#8217;,$message); ?&gt;<br />
effect(&#8216;#message&#8217;,'Highlight&#8217;,array(&#8216;duration&#8217;=&gt;2, &#8217;startcolor&#8217;=&gt;&#8217;#7777ff&#8217;)); ?&gt;</p>
<p>and use $this-&gt;set(&#8216;message&#8217;, __(&#8217;some_msg&#8217;,true)); in your controller.<br />
And if you have many such views  you will not DRY.<br />
But you can create helper Msg with function<br />
showMessage ($message) {<br />
$this-&gt;Page-&gt;replace_html(&#8216;#message&#8217;,$message); ?&gt;<br />
$this-&gt;Page-&gt;effect(&#8216;#message&#8217;,'Highlight&#8217;,array(&#8216;duration&#8217;=&gt;2, &#8217;startcolor&#8217;=&gt;&#8217;#7777ff&#8217;));<br />
}<br />
and use this helper from controller like this:<br />
$this-&gt;Msg-&gt;showMessage(&#8216;ok&#8217;);<br />
exit;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
