<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Code Dojo &#187; CakePHP</title>
	<atom:link href="http://dojo.codegreene.com/category/php/cake/feed/" rel="self" type="application/rss+xml" />
	<link>http://dojo.codegreene.com</link>
	<description>The Code Dojo is the veritable repository of random musings from the development team at Code Greene.</description>
	<lastBuildDate>Fri, 20 Jan 2012 18:09:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Sharpening the Blades: Useful Tweets</title>
		<link>http://dojo.codegreene.com/2010/09/sharpening-the-blades-useful-tweets/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sharpening-the-blades-useful-tweets</link>
		<comments>http://dojo.codegreene.com/2010/09/sharpening-the-blades-useful-tweets/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 19:30:58 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=632</guid>
		<description><![CDATA[Below are some tweets that I have seen recently that I have found to be helpful. Smashing Magazine &#8211; HTML5/CSS3 Cheatsheet &#8211; http://bit.ly/aj0yfA Ben Ludman &#8211; URL shorteners and CakePHP &#8211; Snook.ca http://bit.ly/btTmSP And this site &#8211; HTML5 Doctor &#8211; I couldn&#8217;t track down the tweet that I found it from, but it is a [...]]]></description>
			<content:encoded><![CDATA[<p>Below are some tweets that I have seen recently that I have found to be helpful.</p>
<p><a href="http://twitter.com/smashingmag" target="_blank">Smashing Magazine</a> &#8211; HTML5/CSS3 Cheatsheet &#8211; <a rel="nofollow" href="http://bit.ly/aj0yfA" target="_blank">http://bit.ly/aj0yfA</a></p>
<p><a href="http://twitter.com/benludman" target="_blank">Ben Ludman</a> &#8211; URL shorteners and CakePHP &#8211; Snook.ca <a rel="nofollow" href="http://bit.ly/btTmSP" target="_blank">http://bit.ly/btTmSP</a></p>
<p>And this site &#8211; <a href="http://html5doctor.com/" target="_blank">HTML5 Doctor</a> &#8211; I couldn&#8217;t track down the tweet that I found it from, but it is a great resource for HTML5.</p>
<p>I looked for some tweets about Magento, but just couldn&#8217;t find any that were appealing.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/09/sharpening-the-blades-useful-tweets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharpening the Blades: Document Ready, Admins and Automagic in CakePHP</title>
		<link>http://dojo.codegreene.com/2010/01/sharpening-the-blades-document-ready-admins-and-automagic-in-cakephp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sharpening-the-blades-document-ready-admins-and-automagic-in-cakephp</link>
		<comments>http://dojo.codegreene.com/2010/01/sharpening-the-blades-document-ready-admins-and-automagic-in-cakephp/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 17:00:07 +0000</pubDate>
		<dc:creator>Master Sensei</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=417</guid>
		<description><![CDATA[This edition of Sharpening the Blades features articles about creating admin sections with CakePHP,  how $(document).ready( ) can slow down your site, and the wonderful things CakePHP can do &#8220;automagically.&#8221; Hopefully these articles will help you sharpen your coding blades. Chad, Creating an Admin Section with CakePHP I have come across James blog just recently [...]]]></description>
			<content:encoded><![CDATA[<p>This edition of Sharpening the Blades features articles about creating admin sections with CakePHP,  how $(document).ready( ) can slow down your site, and the wonderful things CakePHP can do &#8220;automagically.&#8221; Hopefully these articles will help you sharpen your coding blades.</p>
<p><strong>Chad</strong>, <a href="http://www.jamesfairhurst.co.uk/posts/view/creating_an_admin_section_with_cakephp_updated">Creating an Admin Section with CakePHP</a><img class="alignright size-full wp-image-424" style="border: 1px solid #444444; margin: 8px 0pt 0px 20px; padding: 2px;" title="cakephp-admin" src="http://dojo.codegreene.com/wp-content/uploads/2010/01/cakephp-admin.jpg" alt="cakephp-admin" width="100" height="100" /><br />
I have come across James blog just recently (about 2 months). The guys blog is great. He does so much with CakePHP that it is great to see what he is doing and what he can do. But the reason I suggest this specific post is because it seems to be the first stumbling block that every developer comes across while using CakePHP. This article specifically will explain how to get an Admin section set up and working. I consider this one of the must needed to know things to develop correctly in CakePHP.</p>
<p><strong>Benjam</strong>,<a href="http://alexsexton.com/?p=22" target="_blank"> Don&#8217;t let Document Ready slow you down</a><img class="alignright size-full wp-image-428" style="border: 1px solid #444444; margin: 8px 0pt 0px 20px; padding: 2px;" title="document-ready" src="http://dojo.codegreene.com/wp-content/uploads/2010/01/document-ready.jpg" alt="document-ready" width="100" height="100" /><br />
Everybody wants to have a faster loading website, and I am certainly guilty of putting every DOM related jQuery snippet into the $(document).ready( ) function.  This post showed me that this wasn&#8217;t absolutely necessary and gives good examples of when and how to break out of the document ready mentality.</p>
<p><strong>Mac, </strong><a href="http://blog.mediarain.com/2009/09/the-dark-side-of-cakephp’s-automagic/" target="_blank">The Dark Side of CakePHP&#8217;s Automagic</a><img class="alignright size-full wp-image-430" style="border: 1px solid #444444; margin: 8px 0pt 0px 20px; padding: 2px;" title="automagic-cakephp" src="http://dojo.codegreene.com/wp-content/uploads/2010/01/automagic-cakephp.jpg" alt="automagic-cakephp" width="100" height="100" /><br />
I&#8217;m not sure I like the title of this article so much as I like the article itself, but it does point out some useful information about the &#8220;automagic&#8221; things that CakePHP does for you. Some of the things they discuss are definitely features that were designed very wisely, even though the article seems to disagree with me on that. There are definitely some automagic things in Cake that they mention that drive me crazy too though, and I don&#8217;t really see the necessity for the seemingly poor decision made by Cake&#8217;s developers. My biggest peeve they mention are the behavior it has (or had, this may have been fixed/changed now) for many-to-many relationships (a.k.a. HABTM). It is really a pain in the neck when your relationship table has other data in it, like the date/time when the relationship was added, or by whom, or a quantity, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/01/sharpening-the-blades-document-ready-admins-and-automagic-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Whirly Bin</title>
		<link>http://dojo.codegreene.com/2009/10/whirly-bin/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=whirly-bin</link>
		<comments>http://dojo.codegreene.com/2009/10/whirly-bin/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 21:39:19 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Online Store]]></category>
		<category><![CDATA[PayPal Online Store]]></category>
		<category><![CDATA[Whirly Bin]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=353</guid>
		<description><![CDATA[We recently launched a small ecommerce site for Whirly Bin. They sell all sorts of stationary. They needed a super simple shopping cart. Instead of hooking in our custom cart in CakePHP we hooked it up to PayPal. Whirly Bin can add new products and upload photos and descriptions for those products through a simple [...]]]></description>
			<content:encoded><![CDATA[<p>We recently launched a small ecommerce site for <a href="http://whirlybin.com" target="_blank">Whirly Bin</a>. They sell all sorts of stationary. They needed a super simple shopping cart. Instead of hooking in our custom cart in <a href="http://cakephp.org/">CakePHP</a> we hooked it up to <a href="http://paypal.com">PayPal</a>. Whirly Bin can add new products and upload photos and descriptions for those products through a simple admin section we created with CakePHP. Whilry Bin was great to work with and we got the site designed, built, and up really quick. <a href="http://whirlybin.com" target="_blank">Check out</a> their site.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2009/10/whirly-bin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;What does that do?&#8221; &#8211; Cake functions I&#8217;ve found</title>
		<link>http://dojo.codegreene.com/2009/05/what-does-that-do-cake-functions-ive-found/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=what-does-that-do-cake-functions-ive-found</link>
		<comments>http://dojo.codegreene.com/2009/05/what-does-that-do-cake-functions-ive-found/#comments</comments>
		<pubDate>Thu, 07 May 2009 22:17:27 +0000</pubDate>
		<dc:creator>Benjam</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=290</guid>
		<description><![CDATA[In this episode of &#8220;What does that do?&#8221; we&#8217;re going to look at a few helpers and methods of (probably) well known classes that may or may not be that well known, as well as enlighten you to a few gotchas that I&#8217;ve discovered during my Cake usage. First is the Set::extract method. When I [...]]]></description>
			<content:encoded><![CDATA[<p>In this episode of &#8220;What does that do?&#8221; we&#8217;re going to look at a few helpers and methods of (probably) well known classes that may or may not be that well known, as well as enlighten you to a few gotchas that I&#8217;ve discovered during my Cake usage.</p>
<p>First is the <tt>Set::extract</tt> method.  When I first started using Cake, I was using the dot notation in my <tt>extract</tt> and <tt>combine</tt> calls, that is until I discovered the XPath notation that was also allowed which offers more control over your returned values.  One gotcha that I discovered early on, was that to emulate the dot notation <var>{n}.Foo</var>, you can&#8217;t just use <var>/Foo</var>, you have to add a <var>/.</var> to the end to make it work properly.  So you end up with <var>/Foo/.</var>.  One other thing I noticed while poking around in the source, was that the argument order for <tt>extract</tt> is opposite from that of <tt>combine</tt>.  With <tt>combine</tt>, you put <var>$data</var>, then <var>$path[12]</var>.  With <tt>extract</tt>, you put in <var>$path</var> first, then <var>$data</var>.  I was doing it wrong for a long time, but the Cake developers thought of this, and silently flip them in <tt>extract</tt> if you get them backwards.</p>
<p><span id="more-290"></span>Another method in <tt>Set</tt> that I never knew about, is <tt>enum</tt>.  With <tt>enum</tt>, you give it a value, and then a list to select from.  The cool thing is, if you don&#8217;t give it a select list, it defaults to yes/no.  I have used this many times since I discovered it.  I often use an active field in my models, and when outputting to my index pages, I would like to see Yes/No, instead of 1/0.  So I just wrap the output in <tt>Set::enum($value)</tt>, and it&#8217;s good to go.</p>
<p>Set has many methods that are really useful.  One that I haven&#8217;t used yet, but would if I needed it, is <tt>normalize</tt>.  I have a similar function in my little bag of tricks that I use in my own code.  What it does is takes a separated string, or an array, and converts them both to an array that has been trimmed.  One gotcha with this one is the <var>$assoc</var> argument (defaults to true).  If this is on and you feed it something like:</p>
<pre class="brush: php">
Set::normalize(&#039;This, is, my, list&#039;);
</pre>
<p>What you&#8217;ll get back is the following:</p>
<pre class="brush: php">
array(
	&#039;This&#039; =&gt; null,
	&#039;is&#039; =&gt; null,
	&#039;my&#039; =&gt; null,
	&#039;list&#039; =&gt; null
);
</pre>
<p>which is not what I was expecting the first time I ran this function.  What I was expecting was:</p>
<pre class="brush: php">
array(
	0 =&gt; &#039;This&#039;,
	1 =&gt; &#039;is&#039;,
	2 =&gt; &#039;my&#039;,
	3 =&gt; &#039;list&#039;
);
</pre>
<p>and to get that, just set <var>$assoc</var> to <tt>false</tt>:</p>
<pre class="brush: php">
Set::normalize(&#039;This, is, my, list&#039;, false);
</pre>
<p>A helper that I discovered recently is the <tt>number</tt> helper.  It doesn&#8217;t have many methods, but I&#8217;ve already used <tt>currency</tt> on more than one occasion, which adds commas and decimals as well as the dollar sign to the output.  It also has <tt>toReadableSize</tt>, which converts a raw file size in bytes to one in kB, MB, GB, etc. based on the size given.  There is a <tt>toPercentage</tt> method, which while it sounds like it might convert decimal numbers to a percentage (e.g.- 0.75 to 75%), all it does is round to the place you give it, and add a percentage sign on the end.  It would make more sense if it did the conversion to percentage as well, instead of just adding a percentage sign, but I digress.</p>
<p>A class that I hadn&#8217;t heard of until a colleague of mine cleaned up some of my code with it, is the <tt>HttpSocket</tt> class.  This class is really cool, it takes all that cURL type stuff, and then some, and wraps it all up in a nice little package.  The methods here that interest me the most are <tt>get</tt>, and <tt>post</tt>.  Both of which do pretty much what you would imagine them to do.</p>
<p>So there are a few of my new favorite unknown functions, what are some that you&#8217;ve discovered and now can&#8217;t live without?</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2009/05/what-does-that-do-cake-functions-ive-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why we use CakePHP</title>
		<link>http://dojo.codegreene.com/2009/02/why-we-use-cakephp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=why-we-use-cakephp</link>
		<comments>http://dojo.codegreene.com/2009/02/why-we-use-cakephp/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 17:46:41 +0000</pubDate>
		<dc:creator>Benjam</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=148</guid>
		<description><![CDATA[When I first started working at Code Greene, I was building my PHP applications and sites the &#8220;old fashioned&#8221; way, with nothing more than a collection of common functions and a single MySQL class that I carried around with me everywhere. I have grown very accustomed to my small collection of code, and have begun [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cakephp.org/"><img src="http://dojo.codegreene.com/wp-content/uploads/2009/02/cake-logo.png" alt="Cake Logo" width="180" height="180" class="alignright size-full wp-image-159" /></a>When I first started working at Code Greene, I was building my PHP applications and sites the &#8220;old fashioned&#8221; way, with nothing more than a collection of common functions and a single MySQL class that I carried around with me everywhere. I have grown very accustomed to my small collection of code, and have begun to rely on it a bit (and actually almost failed the entrance test to Code Greene because I couldn&#8217;t find it).  But I always built my applications from scratch, every time. </p>
<p>As I progressed in my PHP career (and hobbies), I noticed that I was building the same things over and over again, but only slightly different every time.  This was an issue that I had noticed but never really put some serious thought into&#8230; until I started at Code Greene.  My first day there, I was told to take a look at CakePHP and learn it, because it was to be the defacto PHP framework for the office.  I took a quick glance at the code base and was instantly overwhelmed.  There is so much stuff going on behind the scenes in Cake that it boggles the mind a bit.  I went through a few online tutorials, and still felt that I knew nothing about it, let alone how to use it, but I could tell that it would either make or break my new job.<br />
<span id="more-148"></span></p>
<p>My first Cake project with CG was not an easy one&#8211;it was huge.  It was the largest project I had worked on to date, and to top it off, I was forced to code it in Cake, which is almost a whole new language in itself.  As I worked on the project, I felt very frustrated at times, and wanted to just slip outside of the Cake bubble and code things the way I knew how, with some straight PHP.  But I didn&#8217;t, and I&#8217;m glad.  I&#8217;m sure I made a ton of rookie mistakes.  There is an extremely steep learning curve, but I was progressing with my Cake experience, and it&#8217;s well worth it once you get the hang of it.</p>
<p>As I work on projects now, I can pretty much get the whole back-end of the site, and all the inner workings and relationships between the data in the database and everything the administrator needs to <acronym title="Create Read Update Delete">CRUD</acronym> that data set up in less than a day, even for fairly large projects.  All the magic in the background is provided by Cake.  All I have to do is give it some details and let it do it&#8217;s thing.  It truly is cake.  Today, I can turn a small project around in a day or two, when it used to take me a week just to get the relationships and administration stuff built, not including the front end portion of the site.</p>
<p>I&#8217;m by no means a Cake expert, but I have cut my build times down to less than half, and in some cases you can count the percentage decrease on two hands.  I am also no longer overwhelmed by requests for gigantic monolithic sites, and requests to change things that would normally make me cringe.  I look at some of the sites that we build at the office, and I wonder how we could ever possibly build these sites in the time that we do if we didn&#8217;t use Cake. It&#8217;s a win-win situation for both the office and our clients. We don&#8217;t have to sweat the little things, and the client gets a fully-functional site in much less time.</p>
<p>My opinion of Cake may be a bit biased, as I have no basis for comparison.  Other frameworks may be better suited for some of our smaller sites that we build, but I have no doubt that for our larger sites, Cake is the right choice.  In the future, I would also love to try some other frameworks, if only to compare them with Cake, but I&#8217;m pretty sure that CakePHP will always be my framework of choice.</p>
<p>What&#8217;s your framework of choice?  Leave a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2009/02/why-we-use-cakephp/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

