<?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 THIS in THAT and then some</title>
	<atom:link href="http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/</link>
	<description>cakephp and stuff</description>
	<lastBuildDate>Fri, 30 Jul 2010 20:22:55 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Neil Crookes</title>
		<link>http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/comment-page-1/#comment-19</link>
		<dc:creator>Neil Crookes</dc:creator>
		<pubDate>Sun, 04 Jan 2009 19:22:30 +0000</pubDate>
		<guid isPermaLink="false">http://cakealot.com/?p=59#comment-19</guid>
		<description>I reckon so yeah, would be a nice enhancement in 1.3, but I expect it&#039;ll have to wait til 2.0</description>
		<content:encoded><![CDATA[<p>I reckon so yeah, would be a nice enhancement in 1.3, but I expect it&#8217;ll have to wait til 2.0</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kjell</title>
		<link>http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/comment-page-1/#comment-17</link>
		<dc:creator>Kjell</dc:creator>
		<pubDate>Sun, 04 Jan 2009 19:18:51 +0000</pubDate>
		<guid isPermaLink="false">http://cakealot.com/?p=59#comment-17</guid>
		<description>@&lt;a href=&quot;#comment-16&quot; rel=&quot;nofollow&quot;&gt;Neil&lt;/a&gt;: hmm.. worth a ticket, what you think?
</description>
		<content:encoded><![CDATA[<p>@<a href="#comment-16" rel="nofollow">Neil</a>: hmm.. worth a ticket, what you think?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil Crookes</title>
		<link>http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/comment-page-1/#comment-16</link>
		<dc:creator>Neil Crookes</dc:creator>
		<pubDate>Sun, 04 Jan 2009 10:36:42 +0000</pubDate>
		<guid isPermaLink="false">http://cakealot.com/?p=59#comment-16</guid>
		<description>I like your thoughts on moving the non-presentational specific logic out of helpers and into core libs so the logic can be used anywhere. 

I think we&#039;re all heading in the direction of &quot;don&#039;t do it... unless you know what you are doing&quot; aren&#039;t we?</description>
		<content:encoded><![CDATA[<p>I like your thoughts on moving the non-presentational specific logic out of helpers and into core libs so the logic can be used anywhere. </p>
<p>I think we&#8217;re all heading in the direction of &#8220;don&#8217;t do it&#8230; unless you know what you are doing&#8221; aren&#8217;t we?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kjell</title>
		<link>http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/comment-page-1/#comment-15</link>
		<dc:creator>Kjell</dc:creator>
		<pubDate>Sun, 04 Jan 2009 09:16:24 +0000</pubDate>
		<guid isPermaLink="false">http://cakealot.com/?p=59#comment-15</guid>
		<description>Hey.. i am all for it! You may have misunderstood. I said &quot;it is not advisable to beginners&quot; and also &quot;I agree on the duplicate code issue&quot;. I too think they are misconcepted to some extent! I think some calculation methods (not related to views/html) that were introduced in helpers should be put into seperate libs.
 
... App::import(&#039;Core&#039;, &#039;Time&#039;) anyone?

Then, to avoid duplicated code in the view helpers, the lib coulb be reused in the helpers. (think: wrapper)

All peachy.. but why? Simply because this makes it &quot;free to anyone&quot; to just load up the core lib when he needs to calculate something in models, components, controllers.. just like all the other Libs. No hard feelings anymore from there on out :) 

Plus, when the &quot;useful-everywhere&quot; methods are in another space, one can&#039;t harm himself by using View related helper stuff he isn&#039;t supposed to be using.

Back to my previous statement: the beginner. - If we promote on blogs that it is okay to load ANY helper somewhere, then some newbies may think that it is &quot;okay&quot; to do $form-&gt;input in a controller (for whatever reason), which is absolutely not. 

With a BIG BIG disclaimer what methods are helpful inside components/models/controllers this &lt;em&gt;can be&lt;/em&gt; advised, but my reason for not doing so in THIS particular post was that i wanted to keep the list &quot;simple&quot;.</description>
		<content:encoded><![CDATA[<p>Hey.. i am all for it! You may have misunderstood. I said &#8220;it is not advisable to beginners&#8221; and also &#8220;I agree on the duplicate code issue&#8221;. I too think they are misconcepted to some extent! I think some calculation methods (not related to views/html) that were introduced in helpers should be put into seperate libs.</p>
<p>&#8230; App::import(&#8217;Core&#8217;, &#8216;Time&#8217;) anyone?</p>
<p>Then, to avoid duplicated code in the view helpers, the lib coulb be reused in the helpers. (think: wrapper)</p>
<p>All peachy.. but why? Simply because this makes it &#8220;free to anyone&#8221; to just load up the core lib when he needs to calculate something in models, components, controllers.. just like all the other Libs. No hard feelings anymore from there on out :) </p>
<p>Plus, when the &#8220;useful-everywhere&#8221; methods are in another space, one can&#8217;t harm himself by using View related helper stuff he isn&#8217;t supposed to be using.</p>
<p>Back to my previous statement: the beginner. &#8211; If we promote on blogs that it is okay to load ANY helper somewhere, then some newbies may think that it is &#8220;okay&#8221; to do $form->input in a controller (for whatever reason), which is absolutely not. </p>
<p>With a BIG BIG disclaimer what methods are helpful inside components/models/controllers this <em>can be</em> advised, but my reason for not doing so in THIS particular post was that i wanted to keep the list &#8220;simple&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rafael Bandeira</title>
		<link>http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/comment-page-1/#comment-14</link>
		<dc:creator>Rafael Bandeira</dc:creator>
		<pubDate>Sun, 04 Jan 2009 01:09:02 +0000</pubDate>
		<guid isPermaLink="false">http://cakealot.com/?p=59#comment-14</guid>
		<description>I don&#039;t agree with your last two assumptions.
Before going any further on this I would like to say that, &quot;break the rules&quot;/&quot;break the mvc&quot;/&quot;isn’t the CakePHP way&quot; are - much probably - always erroneous. What are the rules and where are them, and how can you possibly know that if you haven&#039;t designed or conceptualized the things you are claiming to be breakable with such behavior?
Anyway, helpers and components are not even part of the firsts sketches about mvc and it&#039;s &quot;rules&quot;, so you are most probably writing based on your own ideas.

Well, I do load helpers everywhere I need them, and I do think that they are misconceptioned in an architectural point of view when being used only as elements of the rendering process. Why would a Helper being loaded inside a component break anything? You must have this answer to write such a thing.
Still on helpers loading, why do you think methods like TimeHelper::daysAsSql() are meant for? Also lots of methods used on views could - should - be used on the model side when storing data, for the sake of performance - like HtmlHelper::clean().

About loading models on Helpers, that&#039;s totally usable too: let&#039;s say that this &quot;rules&quot; only say you shouldn&#039;t retrieve, store or update data outside the Model layer, in between the Controller domain; Now, using model&#039;s signature and parameters to deal with the rendering process - just as the form helper does, isn&#039;t by any means a bad thing, although you can say that same parameters could be passed by the controller to the view.

I think people put too much pragmatism when talking about the MVC pattern - having they studied it or no - and about the X-way of doing something, and being it good or no they are oftenly over carried about something that is not that restrict.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t agree with your last two assumptions.<br />
Before going any further on this I would like to say that, &#8220;break the rules&#8221;/&#8221;break the mvc&#8221;/&#8221;isn’t the CakePHP way&#8221; are &#8211; much probably &#8211; always erroneous. What are the rules and where are them, and how can you possibly know that if you haven&#8217;t designed or conceptualized the things you are claiming to be breakable with such behavior?<br />
Anyway, helpers and components are not even part of the firsts sketches about mvc and it&#8217;s &#8220;rules&#8221;, so you are most probably writing based on your own ideas.</p>
<p>Well, I do load helpers everywhere I need them, and I do think that they are misconceptioned in an architectural point of view when being used only as elements of the rendering process. Why would a Helper being loaded inside a component break anything? You must have this answer to write such a thing.<br />
Still on helpers loading, why do you think methods like TimeHelper::daysAsSql() are meant for? Also lots of methods used on views could &#8211; should &#8211; be used on the model side when storing data, for the sake of performance &#8211; like HtmlHelper::clean().</p>
<p>About loading models on Helpers, that&#8217;s totally usable too: let&#8217;s say that this &#8220;rules&#8221; only say you shouldn&#8217;t retrieve, store or update data outside the Model layer, in between the Controller domain; Now, using model&#8217;s signature and parameters to deal with the rendering process &#8211; just as the form helper does, isn&#8217;t by any means a bad thing, although you can say that same parameters could be passed by the controller to the view.</p>
<p>I think people put too much pragmatism when talking about the MVC pattern &#8211; having they studied it or no &#8211; and about the X-way of doing something, and being it good or no they are oftenly over carried about something that is not that restrict.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kjell</title>
		<link>http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/comment-page-1/#comment-13</link>
		<dc:creator>Kjell</dc:creator>
		<pubDate>Sat, 03 Jan 2009 12:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://cakealot.com/?p=59#comment-13</guid>
		<description>like fahad19 said: &quot;dont try this at home&quot; :)</description>
		<content:encoded><![CDATA[<p>like fahad19 said: &#8220;dont try this at home&#8221; :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil Crookes</title>
		<link>http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/comment-page-1/#comment-12</link>
		<dc:creator>Neil Crookes</dc:creator>
		<pubDate>Sat, 03 Jan 2009 09:35:10 +0000</pubDate>
		<guid isPermaLink="false">http://cakealot.com/?p=59#comment-12</guid>
		<description>You&#039;re right on it being the official line, but there are always occasions when its right to break the rules - if you know what you are doing. Take the Cake core form helper for example - it accesses model objects for validation errors and schemas. I think the official line should be don&#039;t do it... unless you know what you are doing.</description>
		<content:encoded><![CDATA[<p>You&#8217;re right on it being the official line, but there are always occasions when its right to break the rules &#8211; if you know what you are doing. Take the Cake core form helper for example &#8211; it accesses model objects for validation errors and schemas. I think the official line should be don&#8217;t do it&#8230; unless you know what you are doing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kjell</title>
		<link>http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/comment-page-1/#comment-11</link>
		<dc:creator>Kjell</dc:creator>
		<pubDate>Fri, 02 Jan 2009 23:52:43 +0000</pubDate>
		<guid isPermaLink="false">http://cakealot.com/?p=59#comment-11</guid>
		<description>I agree on the duplicate code issue, but it isn&#039;t exactly the CakePHP-way. 

Since you can do alot wrong when breaking the rules it is not advisable to beginners either. That&#039;s why i removed the example from my list. 

You can go that route, if you know what you are doing, but don&#039;t expect others to agree and support.</description>
		<content:encoded><![CDATA[<p>I agree on the duplicate code issue, but it isn&#8217;t exactly the CakePHP-way. </p>
<p>Since you can do alot wrong when breaking the rules it is not advisable to beginners either. That&#8217;s why i removed the example from my list. </p>
<p>You can go that route, if you know what you are doing, but don&#8217;t expect others to agree and support.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil Crookes</title>
		<link>http://cakealot.com/2009/01/how-to-use-this-in-that-and-then-some/comment-page-1/#comment-10</link>
		<dc:creator>Neil Crookes</dc:creator>
		<pubDate>Fri, 02 Jan 2009 21:02:43 +0000</pubDate>
		<guid isPermaLink="false">http://cakealot.com/?p=59#comment-10</guid>
		<description>I recently used a helper in a behavior - I don&#039;t think I was wrong to do so either - here&#039;s the usage:

    App::import(&#039;Helper&#039;, &#039;Text&#039;);
    $TextHelper = new TextHelper();
    $model-&gt;data[$model-&gt;alias][&#039;summary&#039;] = $TextHelper-&gt;truncate($content, 130, &#039;...&#039;, false, true);

I used the text helper truncate method with consideration for html to auto populate a rich text summary field with the first 130 chars from a rich text content field on beforeSave() when creating the record.

I needed to do it this way, cus the administrator could override the default truncated text with their own at a later date if they wanted to.

There is absolutely no reason to write this method again myself. What do you think?</description>
		<content:encoded><![CDATA[<p>I recently used a helper in a behavior &#8211; I don&#8217;t think I was wrong to do so either &#8211; here&#8217;s the usage:</p>
<p>    App::import(&#8217;Helper&#8217;, &#8216;Text&#8217;);<br />
    $TextHelper = new TextHelper();<br />
    $model-&gt;data[$model-&gt;alias]['summary'] = $TextHelper-&gt;truncate($content, 130, &#8216;&#8230;&#8217;, false, true);</p>
<p>I used the text helper truncate method with consideration for html to auto populate a rich text summary field with the first 130 chars from a rich text content field on beforeSave() when creating the record.</p>
<p>I needed to do it this way, cus the administrator could override the default truncated text with their own at a later date if they wanted to.</p>
<p>There is absolutely no reason to write this method again myself. What do you think?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
