<?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>laneolson.ca &#187; CakePHP</title>
	<atom:link href="http://www.laneolson.ca/tag/cakephp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.laneolson.ca</link>
	<description></description>
	<lastBuildDate>Fri, 07 Jan 2011 23:06:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Caching Data Queries in CakePHP</title>
		<link>http://www.laneolson.ca/2009/05/22/caching-data-queries-in-cakephp/</link>
		<comments>http://www.laneolson.ca/2009/05/22/caching-data-queries-in-cakephp/#comments</comments>
		<pubDate>Fri, 22 May 2009 16:44:44 +0000</pubDate>
		<dc:creator>Lane</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://laneolson.ca/?p=33</guid>
		<description><![CDATA[In a recent CMS project in CakePHP I was loading in some data from a model to use nearly on every page.  This data is not updated very often, so I figured I would cache the query.  The method of caching data I am going to outline can be done not just for queries&#8230; but for any kind of data really.  Lets get started!
The Cache Function
CakePHP&#8217;s cache function is quite easy to use.  The code snippet below shows how to use it.

1
2
3
4
5
6
7
8
9
10
11
$cache_name = 'query';
$cache_data = Cache::read&#40;$cache_name&#41;;
if &#40;empty&#40;$cache_data&#41;&#41;
&#123;
	$dataModel = $this-&#62;Model-&#62;find&#40;'first'&#41;;
	Cache::write&#40;$cache_name, $dataModel, array&#40;'config' =&#62; 'File', 'duration' =&#62; 7200&#41;&#41;;
&#125;
else
&#123;
	$dataModel = $cache_data;
&#125;

The code above attempts to read in the data from the cache, given the $cache_name.  If the data is not found, the query is executed and then written to the cache.  As you can see in the Cache::write I am using the File engine for caching, but you can use whichever you desire.  I also set the duration to 7200 seconds (2 hours).  If the cache data IS found then the query is skipped and the cache data is assigned to $dataModel.  Pretty nifty eh?
I also believe that when you do a save operation on the Settings model Cake knows to automatically remove that cache data, so you don&#8217;t end up with out of sync info!  If for some reason you want to manually delete the cached data you can use: Cache::delete($key) for a specific key, or Cache::clear() to delete everything in the cache.
]]></description>
			<content:encoded><![CDATA[<p>In a recent CMS project in CakePHP I was loading in some data from a model to use nearly on every page.  This data is not updated very often, so I figured I would cache the query.  The method of caching data I am going to outline can be done not just for queries&#8230; but for any kind of data really.  Lets get started!</p>
<h3>The Cache Function</h3>
<p>CakePHP&#8217;s cache function is quite easy to use.  The code snippet below shows how to use it.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache_name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'query'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$cache_data</span> <span style="color: #339933;">=</span> Cache<span style="color: #339933;">::</span><span style="color: #004000;">read</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$dataModel</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Model</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'first'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	Cache<span style="color: #339933;">::</span><span style="color: #004000;">write</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dataModel</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'config'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'File'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'duration'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">7200</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$dataModel</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cache_data</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The code above attempts to read in the data from the cache, given the $cache_name.  If the data is not found, the query is executed and then written to the cache.  As you can see in the Cache::write I am using the File engine for caching, but you can use whichever you desire.  I also set the duration to 7200 seconds (2 hours).  If the cache data IS found then the query is skipped and the cache data is assigned to $dataModel.  Pretty nifty eh?</p>
<p>I also believe that when you do a save operation on the Settings model Cake knows to automatically remove that cache data, so you don&#8217;t end up with out of sync info!  If for some reason you want to manually delete the cached data you can use: Cache::delete($key) for a specific key, or Cache::clear() to delete everything in the cache.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.laneolson.ca/2009/05/22/caching-data-queries-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Share Your CakePHP Core and Application Files Server Wide</title>
		<link>http://www.laneolson.ca/2008/12/10/share-your-cakephp-core-server-wide/</link>
		<comments>http://www.laneolson.ca/2008/12/10/share-your-cakephp-core-server-wide/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 23:52:41 +0000</pubDate>
		<dc:creator>Lane</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[code reuse]]></category>

		<guid isPermaLink="false">http://laneolson.wordpress.com/?p=15</guid>
		<description><![CDATA[If you are deploying several Cake applications server wide you may want to keep the Cake core in one central place so that it can be easily updated.  In order to do this place the cake core directory somewhere on your server where is can be accessed.  For example /usr/lib/php/cake.  Then, when you create your applications open up your root index file  and replace the following:

1
2
3
if &#40;!defined&#40;'CAKE_CORE_INCLUDE_PATH'&#41;&#41; &#123;
	define&#40;'CAKE_CORE_INCLUDE_PATH', ROOT&#41;;
&#125;

with this:

1
2
3
if &#40;!defined&#40;'CAKE_CORE_INCLUDE_PATH'&#41;&#41; &#123;
	define&#40;'CAKE_CORE_INCLUDE_PATH', DS . 'usr' . DS . 'lib' . DS . 'php' . DS . 'cake'&#41;;
&#125;

You are now using the common cake core.  When a new update comes out to the library, just replace the files in /usr/lib/php/cake with the new version!
If you want to go a step further and share some of your own models, views, controllers, behaviors, helpers, or components between applications you can use a similar technique.  For example create a folder in &#8216;/usr/lib/php/models&#8217; and put all your common models in that folder, then in your application open up bootstrap.php and add the following:

1
2
3
$modelPaths = array&#40;
DS . 'usr' . DS . 'lib' . DS . 'php' . DS . 'models'
&#41;;

Like I said the same thing can be done with views, controllers, helpers, behaviors or components.  The cookbook says how!  This is pretty handy for when you find a bug in a model and you have several applications using that model!

]]></description>
			<content:encoded><![CDATA[<p>If you are deploying several Cake applications server wide you may want to keep the Cake core in one central place so that it can be easily updated.  In order to do this place the cake core directory somewhere on your server where is can be accessed.  For example /usr/lib/php/cake.  Then, when you create your applications open up your root index file  and replace the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CAKE_CORE_INCLUDE_PATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CAKE_CORE_INCLUDE_PATH'</span><span style="color: #339933;">,</span> ROOT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>with this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CAKE_CORE_INCLUDE_PATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CAKE_CORE_INCLUDE_PATH'</span><span style="color: #339933;">,</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'usr'</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'lib'</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'php'</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'cake'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>You are now using the common cake core.  When a new update comes out to the library, just replace the files in /usr/lib/php/cake with the new version!</p>
<p>If you want to go a step further and share some of your own models, views, controllers, behaviors, helpers, or components between applications you can use a similar technique.  For example create a folder in &#8216;/usr/lib/php/models&#8217; and put all your common models in that folder, then in your application open up bootstrap.php and add the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$modelPaths</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'usr'</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'lib'</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'php'</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'models'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span class="keyword">Like I said the same thing can be done with views, controllers, helpers, behaviors or components.  The <a href="http://book.cakephp.org/view/36/Additional-Class-Paths">cookbook says how</a>!  This is pretty handy for when you find a bug in a model and you have several applications using that model!<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.laneolson.ca/2008/12/10/share-your-cakephp-core-server-wide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tip: Build Forms Quicker in CakePHP</title>
		<link>http://www.laneolson.ca/2008/12/09/tip-build-forms-quicker-in-cakephp/</link>
		<comments>http://www.laneolson.ca/2008/12/09/tip-build-forms-quicker-in-cakephp/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 02:53:39 +0000</pubDate>
		<dc:creator>Lane</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Form Helper]]></category>

		<guid isPermaLink="false">http://laneolson.wordpress.com/?p=8</guid>
		<description><![CDATA[The form helper is great and has saved me many hours of manually coding form inputs.  This article will show you how to use the $form-&#62;inputs() function to automagically build a form.]]></description>
			<content:encoded><![CDATA[<p>I first saw use of the $form->inputs() function for building a form on <a href="http://snook.ca/archives/cakephp/contact_form_cakephp/" target="_blank">Johnathan Snook&#8217;s blog post about creating a contact form</a>.  After investigating further into the function, I found that it can be used to save quite a bit of time.</p>
<h3>Automagic Forms!</h3>
<p>Using $form->input() is great, but when you have many fields or you are just creating a quick form there is a better way!  The key is to set up your database table structure properly.  If you follow the <a href="http://book.cakephp.org/complete/22/CakePHP-Conventions" target="_blank">naming conventions</a> creating a form is as easy as using the following code in the view (this is for a Contact model&#8230; obviously):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>php
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Contact'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">inputs</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">end</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Save Contact&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>This is pretty nice, but what happens if you have fields that you don&#8217;t want the user to fill out?  Use the blacklist!  The following code removes the fieldset and legend along with the fields id, created, and modified.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>php
<span style="color: #000088;">$inputs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fieldset'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'legend'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$blacklist</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'created'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'modified'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Contact'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">inputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$inputs</span><span style="color: #339933;">,</span> <span style="color: #000088;">$blacklist</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">end</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Save Contact&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Not too bad.  Fully functional form in 5 lines of code!  But wait&#8230; There&#8217;s more!  You may still want to customize the form a little more to add certain options to some fields.  This can be done with the $inputs array.  Basically all you have to do is add a key in the $inputs array with the field name, and then assign the optional attributes as you would if you were using the $form->input() function.  Here is an example of what the array would look like to add a hint after the &#8220;first name&#8221; field.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$inputs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'fieldset'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'legend'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'first_name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'after'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'i.e. Lane'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The only drawback with assigning the optional attributes is that now the $inputs array must contain a key for every input you want to have a form field for.  I&#8217;m sure that there is a better way to do this, but you could do something like this in the controller:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>php
<span style="color: #000000; font-weight: bold;">function</span> add<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$schema</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Contact</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">schema</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$schema</span> <span style="color: #b1b100;">as</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$field</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">compact</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'schema'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>and then in the view do this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$inputs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fieldset'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'legend'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$inputs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$inputs</span><span style="color: #339933;">,</span> <span style="color: #000088;">$schema</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$inputs</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'first_name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'after'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'i.e. Lane'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This method would get the job done, but would really only be practical if you had a whole bunch of fields.  Otherwise creating each $form->input() might be the way to go if you have to assign some options.  Nonetheless,  I&#8217;ve found that you can bypass having to set the $options array for specific fields by following the naming conventions, and when that is the case there is nothing better than $form->inputs()!</p>
<h3>Related Links</h3>
<ul>
<li><a href="http://book.cakephp.org/complete/182/Form" target="_blank">The Form Helper</a></li>
<li><a href="http://api.cakephp.org/class_form_helper.html" target="_blank">Form Helper API</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.laneolson.ca/2008/12/09/tip-build-forms-quicker-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

