<?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: Stupid CakePHP Controller Tricks</title>
	<atom:link href="http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss</link>
	<description>Facebook should&#039;ve be written in unicornSchemaLang, because everyone *knows* that PHP is no good for anything, right?</description>
	<lastBuildDate>Sun, 14 Mar 2010 00:58:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
		<item>
		<title>By: k00k</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/comment-page-1/#comment-11265</link>
		<dc:creator>k00k</dc:creator>
		<pubDate>Sat, 17 Jan 2009 19:37:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/#comment-11265</guid>
		<description>Thanks man, exactly what I was looking for.</description>
		<content:encoded><![CDATA[<p>Thanks man, exactly what I was looking for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Torzynski</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/comment-page-1/#comment-10829</link>
		<dc:creator>Rick Torzynski</dc:creator>
		<pubDate>Wed, 15 Oct 2008 15:24:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/#comment-10829</guid>
		<description>Thanks for the tip - helped me out!</description>
		<content:encoded><![CDATA[<p>Thanks for the tip &#8211; helped me out!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tgr</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/comment-page-1/#comment-10795</link>
		<dc:creator>Tgr</dc:creator>
		<pubDate>Wed, 01 Oct 2008 11:34:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/#comment-10795</guid>
		<description>$this-&gt;set(&#039;foo_bar&#039;, $foo_bar) vill result in a variable called $foo_bar. 
$this-&gt;set(compact(&#039;foo_bar&#039;)) will however result in $fooBar, because Controller::set() calls the variable inflector if and only if the first argument is an array and the second is null.
Can&#039;t decide whether this is intentionally evil or just plain stupid...</description>
		<content:encoded><![CDATA[<p>$this-&gt;set(&#8216;foo_bar&#8217;, $foo_bar) vill result in a variable called $foo_bar.<br />
$this-&gt;set(compact(&#8216;foo_bar&#8217;)) will however result in $fooBar, because Controller::set() calls the variable inflector if and only if the first argument is an array and the second is null.<br />
Can&#8217;t decide whether this is intentionally evil or just plain stupid&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Promet CakePHP Source&#187; Blog Archive &#187; What is compact() in controller?</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/comment-page-1/#comment-10759</link>
		<dc:creator>Promet CakePHP Source&#187; Blog Archive &#187; What is compact() in controller?</dc:creator>
		<pubDate>Thu, 18 Sep 2008 08:59:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/#comment-10759</guid>
		<description>[...]  compact is a native PHP function that creates an array containing variables and their values. Chris Hartjes explains it well in his blog. It&#8217;s quite neat because it will save me a few lines and [...]</description>
		<content:encoded><![CDATA[<p>[...]  compact is a native PHP function that creates an array containing variables and their values. Chris Hartjes explains it well in his blog. It&#8217;s quite neat because it will save me a few lines and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/comment-page-1/#comment-6979</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Wed, 15 Aug 2007 03:40:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/#comment-6979</guid>
		<description>@Chris: actually, get_defined_vars doesn&#039;t pull in anything beyond what&#039;s in the current method scope.  This does *not* include any object properties (from $this) or anything that Cake has defined.  It only includes variables you declare, and the parameters of the method itself.

In the view, you can do $this-&gt;getVars() to get a listing of variables passed from the controller.  Or just do array_keys(get_defined_vars()) in the controller to see what you&#039;re passing.  Either way, if you think get_defined_vars() is inefficient, then it&#039;s more than likely that your controller code itself is inefficient, and you&#039;re being lazy in your variable assignments.</description>
		<content:encoded><![CDATA[<p>@Chris: actually, get_defined_vars doesn&#8217;t pull in anything beyond what&#8217;s in the current method scope.  This does *not* include any object properties (from $this) or anything that Cake has defined.  It only includes variables you declare, and the parameters of the method itself.</p>
<p>In the view, you can do $this-&gt;getVars() to get a listing of variables passed from the controller.  Or just do array_keys(get_defined_vars()) in the controller to see what you&#8217;re passing.  Either way, if you think get_defined_vars() is inefficient, then it&#8217;s more than likely that your controller code itself is inefficient, and you&#8217;re being lazy in your variable assignments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Hartjes</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/comment-page-1/#comment-6956</link>
		<dc:creator>Chris Hartjes</dc:creator>
		<pubDate>Fri, 10 Aug 2007 16:49:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/#comment-6956</guid>
		<description>@Manny:  I don&#039;t imagine there is any sort of performance hit.  Which do you think takes more time:  using compact to send 4 variables via $this-&gt;set() or to run $this-&gt;set() 4 times?  My money is on compact() being just as fast.</description>
		<content:encoded><![CDATA[<p>@Manny:  I don&#8217;t imagine there is any sort of performance hit.  Which do you think takes more time:  using compact to send 4 variables via $this->set() or to run $this->set() 4 times?  My money is on compact() being just as fast.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manny</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/comment-page-1/#comment-6955</link>
		<dc:creator>Manny</dc:creator>
		<pubDate>Fri, 10 Aug 2007 15:24:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/#comment-6955</guid>
		<description>Great tip!

Do you know if there are any performance hits with using compact?</description>
		<content:encoded><![CDATA[<p>Great tip!</p>
<p>Do you know if there are any performance hits with using compact?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anty</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/comment-page-1/#comment-6943</link>
		<dc:creator>anty</dc:creator>
		<pubDate>Wed, 08 Aug 2007 08:14:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/#comment-6943</guid>
		<description>The first trick is neat, the second one is terribly ugly :)
I wouldn&#039;t ever use the second one because if you look at your code after two month you won&#039;t remember what you actually assign to the view.

Thanks for sharing!</description>
		<content:encoded><![CDATA[<p>The first trick is neat, the second one is terribly ugly <img src='http://www.littlehart.net/atthekeyboard/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I wouldn&#8217;t ever use the second one because if you look at your code after two month you won&#8217;t remember what you actually assign to the view.</p>
<p>Thanks for sharing!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Hartjes</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/comment-page-1/#comment-6938</link>
		<dc:creator>Chris Hartjes</dc:creator>
		<pubDate>Wed, 08 Aug 2007 01:56:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/#comment-6938</guid>
		<description>@paitken: Thanks for pointing that out, I fixed it in the post

@Geoff: There used to be a segment on Dave Letterman&#039;s show called &quot;Stupid Human Tricks&quot;, so I sort of took the same idea.

@nate: It won&#039;t make you smarter, it just makes your code look better.  I worry about what other info get_defined_vars() pulls in thanks to scope issues.  Is there a way to print out a list of all variables that are available in a view?

@Lamby: I think if you put {php} and {/php} (replace the curly braces with square braces) around your code sample it should show up in the comments as properly formatted code.</description>
		<content:encoded><![CDATA[<p>@paitken: Thanks for pointing that out, I fixed it in the post</p>
<p>@Geoff: There used to be a segment on Dave Letterman&#8217;s show called &#8220;Stupid Human Tricks&#8221;, so I sort of took the same idea.</p>
<p>@nate: It won&#8217;t make you smarter, it just makes your code look better.  I worry about what other info get_defined_vars() pulls in thanks to scope issues.  Is there a way to print out a list of all variables that are available in a view?</p>
<p>@Lamby: I think if you put {php} and {/php} (replace the curly braces with square braces) around your code sample it should show up in the comments as properly formatted code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lamby</title>
		<link>http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/comment-page-1/#comment-6936</link>
		<dc:creator>Lamby</dc:creator>
		<pubDate>Wed, 08 Aug 2007 01:17:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/#comment-6936</guid>
		<description>Aw, my code was eaten by the comment system. :(</description>
		<content:encoded><![CDATA[<p>Aw, my code was eaten by the comment system. <img src='http://www.littlehart.net/atthekeyboard/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->