<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>A Slice of Cake</title>
	<atom:link href="http://sliceofcake.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sliceofcake.wordpress.com</link>
	<description>CakePHP notes and ideas... and other PHP, JavaScript, CSS, HTML Stuff</description>
	<lastBuildDate>Tue, 20 Sep 2011 12:24:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sliceofcake.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>A Slice of Cake</title>
		<link>http://sliceofcake.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sliceofcake.wordpress.com/osd.xml" title="A Slice of Cake" />
	<atom:link rel='hub' href='http://sliceofcake.wordpress.com/?pushpress=hub'/>
		<item>
		<title>loadModel</title>
		<link>http://sliceofcake.wordpress.com/2007/09/20/loadmodel/</link>
		<comments>http://sliceofcake.wordpress.com/2007/09/20/loadmodel/#comments</comments>
		<pubDate>Thu, 20 Sep 2007 17:44:33 +0000</pubDate>
		<dc:creator>Shawn Starkey</dc:creator>
				<category><![CDATA[CakePHP 1.1]]></category>
		<category><![CDATA[Controllers]]></category>
		<category><![CDATA[Models]]></category>

		<guid isPermaLink="false">http://sliceofcake.wordpress.com/2007/09/20/loadmodel/</guid>
		<description><![CDATA[Provide access to a model from a Component Say you have a model called FoosFum in a file called foos_fum.php Limit the size of your controller If you only use a model in certain circumstances do not use the $uses array, use loadModel where you need it. &#160; References: http://manual.cakephp.org/chapter/controllers Google Group http://manual.cakephp.org/chapter/components &#160; &#160;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=16&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><b>Provide access to a model from a Component</b><br />
Say you have a model called FoosFum in a file called foos_fum.php</p>
<p><code></code></p>
<p><pre class="brush: php;">
loadModel('FoosFum');
$this-&gt;FoosFum = &amp;new FoosFum();</pre></p>
<p align="left"><b>Limit the size of your controller</b></p>
<p align="left">If you only use a model in certain circumstances do not use the $uses array, use loadModel where you need it.</p>
<p align="left">&nbsp;</p>
<p align="left"><b>References:</b><br />
<a href="http://groups.google.com/group/cake-php/browse_thread/thread/981980f500c5f54e/f71a68e4c5ce6d34?lnk=gst&amp;q=loadModel+uses&amp;rnum=1#f71a68e4c5ce6d34"></a><a href="http://manual.cakephp.org/chapter/controllers">http://manual.cakephp.org/chapter/controllers</a><br />
<a href="http://groups.google.com/group/cake-php/browse_thread/thread/981980f500c5f54e/f71a68e4c5ce6d34?lnk=gst&amp;q=loadModel+%24uses&amp;rnum=1#f71a68e4c5ce6d34"> Google Group</a><br />
<a href="http://manual.cakephp.org/chapter/components">http://manual.cakephp.org/chapter/components</a></p>
<p align="left">&nbsp;</p>
<p align="left">&nbsp;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sliceofcake.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sliceofcake.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sliceofcake.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sliceofcake.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sliceofcake.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sliceofcake.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sliceofcake.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sliceofcake.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sliceofcake.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sliceofcake.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sliceofcake.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sliceofcake.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sliceofcake.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sliceofcake.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sliceofcake.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sliceofcake.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=16&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sliceofcake.wordpress.com/2007/09/20/loadmodel/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/890e40cffc758ef06b0b8ca4a41298da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shawn</media:title>
		</media:content>
	</item>
		<item>
		<title>Use JavaScript to Find the Center of the Browser.</title>
		<link>http://sliceofcake.wordpress.com/2007/09/13/use-javascript-to-find-the-center-of-the-browser/</link>
		<comments>http://sliceofcake.wordpress.com/2007/09/13/use-javascript-to-find-the-center-of-the-browser/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 18:50:21 +0000</pubDate>
		<dc:creator>Shawn Starkey</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Pie]]></category>

		<guid isPermaLink="false">http://sliceofcake.wordpress.com/2007/09/13/use-javascript-to-find-the-center-of-the-browser/</guid>
		<description><![CDATA[I found myself in a situation where I needed to dynamically display a div in the center of browser&#8217;s window without knowing anything about the page or where the user was on it. For example, the user could be at the top of a page or could have scrolled 3000 pixels down. I also wasn&#8217;t [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=14&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I found myself in a situation where I needed to dynamically display a div in the center of browser&#8217;s window without knowing anything about the page or where the user was on it.  For example, the user could be at the top of a page or could have scrolled 3000 pixels down.  I also wasn&#8217;t allowed to use mouse clicks or anything to determine where the users was.</p>
<p>So, to use JavaScript to find the center of the browser&#8217;s window regardless of where the  user is:</p>
<p><pre class="brush: jscript;">
posY = getScreenCenterY();
posX = getScreenCenterX();

dv = document.createElement('div');
dv.setAttribute('id',"css_dialog");
dv.style.cssText = "position:absolute;top:"+posY+"px;left:"+posX+"px;";

function getScreenCenterY() {
var y = 0;

y = getScrollOffset()+(getInnerHeight()/2);

return(y);
}

function getScreenCenterX() {
return(document.body.clientWidth/2);
}

function getInnerHeight() {
var y;
if (self.innerHeight) // all except Explorer
{
y = self.innerHeight;
}
else if (document.documentElement &amp;amp;&amp;amp;
document.documentElement.clientHeight)
// Explorer 6 Strict Mode
{
y = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
y = document.body.clientHeight;
}
return(y);
}

function getScrollOffset() {
var y;
if (self.pageYOffset) // all except Explorer
{
y = self.pageYOffset;
}
else if (document.documentElement &amp;amp;&amp;amp;
document.documentElement.scrollTop)
// Explorer 6 Strict
{
y = document.documentElement.scrollTop;
}
else if (document.body) // all other Explorers
{
y = document.body.scrollTop;
}
return(y);
}
</pre></p>
<p>Many thanks to Quirksmode for this page: <a href="http://www.quirksmode.org/viewport/compatibility.html" title="JavaScript screen properties."><font size="-1"><span class="a">www.quirksmode.org/viewport/compatibility.html</span></font></a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sliceofcake.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sliceofcake.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sliceofcake.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sliceofcake.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sliceofcake.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sliceofcake.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sliceofcake.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sliceofcake.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sliceofcake.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sliceofcake.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sliceofcake.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sliceofcake.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sliceofcake.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sliceofcake.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sliceofcake.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sliceofcake.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=14&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sliceofcake.wordpress.com/2007/09/13/use-javascript-to-find-the-center-of-the-browser/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/890e40cffc758ef06b0b8ca4a41298da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shawn</media:title>
		</media:content>
	</item>
		<item>
		<title>Not So Stupid Trick&#8230; compact()</title>
		<link>http://sliceofcake.wordpress.com/2007/08/16/not-so-stupid-trick-compact/</link>
		<comments>http://sliceofcake.wordpress.com/2007/08/16/not-so-stupid-trick-compact/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 17:41:43 +0000</pubDate>
		<dc:creator>Shawn Starkey</dc:creator>
				<category><![CDATA[CakePHP 1.1]]></category>
		<category><![CDATA[Controllers]]></category>
		<category><![CDATA[Views]]></category>

		<guid isPermaLink="false">http://sliceofcake.wordpress.com/2007/08/16/not-so-stupid-trick-compact/</guid>
		<description><![CDATA[Here is a good post that explains how to make several local variables available to the view at once. Of course, you can always reference $this-&#62;data in the view&#8230;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=13&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is a good post that explains how to <a href="http://www.littlehart.net/atthekeyboard/2007/08/07/stupid-cakephp-controller-tricks/">make several local variables available to the view at once</a>.</p>
<p>Of course, you can always reference $this-&gt;data in the view&#8230;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sliceofcake.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sliceofcake.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sliceofcake.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sliceofcake.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sliceofcake.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sliceofcake.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sliceofcake.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sliceofcake.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sliceofcake.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sliceofcake.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sliceofcake.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sliceofcake.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sliceofcake.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sliceofcake.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sliceofcake.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sliceofcake.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=13&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sliceofcake.wordpress.com/2007/08/16/not-so-stupid-trick-compact/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/890e40cffc758ef06b0b8ca4a41298da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shawn</media:title>
		</media:content>
	</item>
		<item>
		<title>Count characters in a textarea.</title>
		<link>http://sliceofcake.wordpress.com/2007/08/16/count-characters-in-a-textarea/</link>
		<comments>http://sliceofcake.wordpress.com/2007/08/16/count-characters-in-a-textarea/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 17:31:28 +0000</pubDate>
		<dc:creator>Shawn Starkey</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Pie]]></category>

		<guid isPermaLink="false">http://sliceofcake.wordpress.com/2007/08/16/count-characters-in-a-textarea/</guid>
		<description><![CDATA[You just need the bolded text&#8230; &#60;html&#62; &#60;HEAD&#62; &#60;script type=&#8221;text/javascript&#8221;&#62; function textCounter(textarea, counterID, maxLen) { cnt = document.getElementById(counterID); if (textarea.value.length &#62; maxLen) { textarea.value = textarea.value.substring(0,maxLen); } cnt.innerHTML = maxLen &#8211; textarea.value.length; } &#60;/script&#62; &#60;/HEAD&#62; &#60;body&#62; &#60;center&#62; &#60;form action=&#8221;whatever.php&#8221;&#62; &#60;textarea name=&#8221;text_area&#8221; cols=&#8221;50&#8243; rows=&#8221;5&#8243; onKeyUp=&#8221;textCounter(this,&#8217;count_display&#8217;,3500);&#8221; &#62; onBlur=&#8221;textCounter(this,&#8217;count_display&#8217;,3500);&#8221; &#62; &#60;/textarea&#62; &#60;br&#62; &#60;span id=&#8221;count_display&#8221;&#62;3500&#60;/SPAN&#62; characters remaining &#60;input type=&#8221;submit&#8221; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=12&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" align="left">You just need the bolded text&#8230;</p>
<p class="MsoNormal" align="left"> <span style="font-size:10pt;font-family:'Courier New';">&lt;html&gt;<br />
&lt;HEAD&gt;</span></p>
<p class="MsoNormal" align="left"> <span style="font-size:10pt;font-family:'Courier New';"></span><strong><span style="font-size:10pt;font-family:'Courier New';">&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
function textCounter(textarea, counterID, maxLen) {<br />
cnt = document.getElementById(counterID);<br />
if (textarea.value.length &gt; maxLen)<br />
{<br />
textarea.value = textarea.value.substring(0,maxLen);<br />
}<br />
cnt.innerHTML = maxLen &#8211; textarea.value.length;<br />
}<br />
&lt;/script&gt;</span></strong></p>
<p class="MsoNormal" align="left"><span style="font-size:10pt;font-family:'Courier New';"> </span></p>
<p class="MsoNormal" align="left"> <span style="font-size:10pt;font-family:'Courier New';">&lt;/HEAD&gt;<br />
&lt;body&gt;<br />
&lt;center&gt;<br />
&lt;form action=&#8221;whatever.php&#8221;&gt;</span></p>
<p class="MsoNormal" align="left"> <span style="font-size:10pt;font-family:'Courier New';">&lt;textarea name=&#8221;text_area&#8221; cols=&#8221;50&#8243; rows=&#8221;5&#8243;<span> </span></span><span style="font-size:10pt;font-family:'Courier New';"><strong>onKeyUp=&#8221;textCounter(this,&#8217;count_display&#8217;,3500);&#8221;</strong> &gt;<br />
</span><span style="font-size:10pt;font-family:'Courier New';"><strong>onBlur=&#8221;textCounter(this,&#8217;count_display&#8217;,3500);&#8221;</strong> &gt;<br />
</span><span style="font-size:10pt;font-family:'Courier New';">&lt;/textarea&gt;<br />
&lt;br&gt;</span></p>
<p class="MsoNormal" align="left"> <span style="font-size:10pt;font-family:'Courier New';"></span><strong><span style="font-size:10pt;font-family:'Courier New';">&lt;span id=&#8221;count_display&#8221;&gt;3500&lt;/SPAN&gt; characters remaining</span></strong></p>
<p class="MsoNormal" align="left"><span style="font-size:10pt;font-family:'Courier New';"> </span></p>
<p class="MsoNormal" align="left"> <span style="font-size:10pt;font-family:'Courier New';">&lt;input type=&#8221;submit&#8221; value=&#8221;Submit&#8221;&gt;<br />
&lt;/form&gt;<br />
&lt;/center&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sliceofcake.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sliceofcake.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sliceofcake.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sliceofcake.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sliceofcake.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sliceofcake.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sliceofcake.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sliceofcake.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sliceofcake.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sliceofcake.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sliceofcake.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sliceofcake.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sliceofcake.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sliceofcake.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sliceofcake.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sliceofcake.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=12&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sliceofcake.wordpress.com/2007/08/16/count-characters-in-a-textarea/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/890e40cffc758ef06b0b8ca4a41298da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shawn</media:title>
		</media:content>
	</item>
		<item>
		<title>Open a Form</title>
		<link>http://sliceofcake.wordpress.com/2007/08/15/open-a-form/</link>
		<comments>http://sliceofcake.wordpress.com/2007/08/15/open-a-form/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 13:19:04 +0000</pubDate>
		<dc:creator>Shawn Starkey</dc:creator>
				<category><![CDATA[CakePHP 1.1]]></category>
		<category><![CDATA[Helpers]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://sliceofcake.wordpress.com/2007/08/15/open-a-form/</guid>
		<description><![CDATA[There isn&#8217;t really a helper method to create a form in Cake 1.1.X; it is deprecated. To create a form the easiest way would be to write: form action=&#8221;&#60;?php echo $html-&#62;url(&#8216;/&#8217; . $this-&#62;controller-&#62;name . &#8216;/&#8217; . $this-&#62;controller-&#62;action)?&#62;&#8221; method=&#8221;post&#8221;&#62;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=11&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There isn&#8217;t really a helper method to create a form in Cake 1.1.X; it is deprecated.  To create a form the easiest way would be to write:</p>
<p>form action=&#8221;&lt;?php echo $html-&gt;url(&#8216;/&#8217; . $this-&gt;controller-&gt;name . &#8216;/&#8217; . $this-&gt;controller-&gt;action)?&gt;&#8221; method=&#8221;post&#8221;&gt;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sliceofcake.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sliceofcake.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sliceofcake.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sliceofcake.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sliceofcake.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sliceofcake.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sliceofcake.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sliceofcake.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sliceofcake.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sliceofcake.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sliceofcake.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sliceofcake.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sliceofcake.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sliceofcake.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sliceofcake.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sliceofcake.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=11&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sliceofcake.wordpress.com/2007/08/15/open-a-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/890e40cffc758ef06b0b8ca4a41298da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shawn</media:title>
		</media:content>
	</item>
		<item>
		<title>Checkbox and Database</title>
		<link>http://sliceofcake.wordpress.com/2007/08/14/checkbox-and-database/</link>
		<comments>http://sliceofcake.wordpress.com/2007/08/14/checkbox-and-database/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 19:27:56 +0000</pubDate>
		<dc:creator>Shawn Starkey</dc:creator>
				<category><![CDATA[CakePHP 1.1]]></category>
		<category><![CDATA[Helpers]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://sliceofcake.wordpress.com/2007/08/14/checkbox-and-database/</guid>
		<description><![CDATA[To make life somewhat easier, database columns that will be rendered as checkboxes should be of type tinyint (or number) with values of zero and one (where 1 is checked). The definition of the html-&#62;checkbox function is (note: title is not used): Whether or not the checkbox is checked is based on the htmlAttributes array. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=4&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To make life somewhat easier, database columns that will be rendered as checkboxes should be of type tinyint (or number) with values of zero and one (where 1 is checked).</p>
<p>The definition of the html-&gt;checkbox function is (note: title is not used):<br />
<pre class="brush: php;">
checkbox($fieldName, $title = null, $htmlAttributes = array(), $return = false)
</pre></p>
<p>Whether or not the checkbox is checked is based on the htmlAttributes array.  To illustrate what I mean, these $htmlAttribute arrays will result in a checked checkbox:</p>
<p><pre class="brush: php;">
array('value'=&gt;1)
array('value'=&gt;0)
array('checked'=&gt;1)
array('checked'=&gt;0)
array('checked'=&gt;'checked')
</pre></p>
<p>A bit of odd code does make the value of 0 (zero) also check the checkbox, so do not do this<br />
<pre class="brush: php;">
echo $html-&gt;checkbox('Model/column', null, array('value'=&gt;$ind));
</pre></p>
<p>and expect the checkbox to be unchecked if $ind is zero.  It seems this would be the right thing to do to optimize your code, however, it does not work as expected.</p>
<p>So, to create a checkbox you&#8217;d write the easiest thing possible:<br />
<pre class="brush: php;">
echo $html-&gt;checkbox('Model/column');
</pre></p>
<p>and CakePHP will make it checked for you (no extra code required).</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sliceofcake.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sliceofcake.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sliceofcake.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sliceofcake.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sliceofcake.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sliceofcake.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sliceofcake.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sliceofcake.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sliceofcake.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sliceofcake.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sliceofcake.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sliceofcake.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sliceofcake.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sliceofcake.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sliceofcake.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sliceofcake.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=4&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sliceofcake.wordpress.com/2007/08/14/checkbox-and-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/890e40cffc758ef06b0b8ca4a41298da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shawn</media:title>
		</media:content>
	</item>
		<item>
		<title>echo HTML Helper output</title>
		<link>http://sliceofcake.wordpress.com/2007/08/14/echo-html-helper-output/</link>
		<comments>http://sliceofcake.wordpress.com/2007/08/14/echo-html-helper-output/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 15:31:09 +0000</pubDate>
		<dc:creator>Shawn Starkey</dc:creator>
				<category><![CDATA[CakePHP 1.1]]></category>
		<category><![CDATA[Helpers]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://sliceofcake.wordpress.com/2007/08/14/echo-html-helper-output/</guid>
		<description><![CDATA[If you do not have AUTO_OUTPUT set to TRUE in /cake/app/config/core.php then be sure to echo all HTML helper methods. Example: This is also true when rendering elements (which is also done in the View):<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=7&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you do not have AUTO_OUTPUT set to TRUE in /cake/app/config/core.php then be sure to echo all HTML helper methods.</p>
<p>Example:<br />
<pre class="brush: php;">
echo $html-&gt;input('Model/column', array('size'=&gt;'1', 'maxlength'=&gt;'1'));
</pre></p>
<p>This is also true when rendering elements (which is also done in the View):<br />
<pre class="brush: php;">
echo $this-&gt;renderElement('menu');
</pre></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sliceofcake.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sliceofcake.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sliceofcake.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sliceofcake.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sliceofcake.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sliceofcake.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sliceofcake.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sliceofcake.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sliceofcake.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sliceofcake.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sliceofcake.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sliceofcake.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sliceofcake.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sliceofcake.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sliceofcake.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sliceofcake.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=7&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sliceofcake.wordpress.com/2007/08/14/echo-html-helper-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/890e40cffc758ef06b0b8ca4a41298da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shawn</media:title>
		</media:content>
	</item>
		<item>
		<title>Variable title</title>
		<link>http://sliceofcake.wordpress.com/2007/08/14/variable-title/</link>
		<comments>http://sliceofcake.wordpress.com/2007/08/14/variable-title/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 15:23:32 +0000</pubDate>
		<dc:creator>Shawn Starkey</dc:creator>
				<category><![CDATA[CakePHP 1.1]]></category>

		<guid isPermaLink="false">http://sliceofcake.wordpress.com/2007/08/14/variable-title/</guid>
		<description><![CDATA[The variable $title is reserved for the title of the page. Do not use it for anything else. Example:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=6&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The variable $title is reserved for the title of the page.  Do not use it for anything else.</p>
<p>Example:<br />
<pre class="brush: php;">
$this-&gt;set('title', 'Add a Post');
</pre></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sliceofcake.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sliceofcake.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sliceofcake.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sliceofcake.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sliceofcake.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sliceofcake.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sliceofcake.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sliceofcake.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sliceofcake.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sliceofcake.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sliceofcake.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sliceofcake.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sliceofcake.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sliceofcake.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sliceofcake.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sliceofcake.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=6&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sliceofcake.wordpress.com/2007/08/14/variable-title/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/890e40cffc758ef06b0b8ca4a41298da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shawn</media:title>
		</media:content>
	</item>
		<item>
		<title>Find Function</title>
		<link>http://sliceofcake.wordpress.com/2007/08/14/find-function/</link>
		<comments>http://sliceofcake.wordpress.com/2007/08/14/find-function/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 15:20:40 +0000</pubDate>
		<dc:creator>Shawn Starkey</dc:creator>
				<category><![CDATA[CakePHP 1.1]]></category>
		<category><![CDATA[Models]]></category>

		<guid isPermaLink="false">http://sliceofcake.wordpress.com/2007/08/14/find-function/</guid>
		<description><![CDATA[The find() function has the following parameters: string $conditions array $fields string $order int $recursive Returns the specified (or all if not specified) fields from the first record that matches $conditions or FALSE if no data is found. Recursive must be -1 to not return any associated data. Example: Return example (i.e. value in $one_row): [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=5&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <strong>find()</strong> function has the following parameters:</p>
<ul>
<li>string <em>$conditions</em></li>
<li>array <em>$fields</em></li>
<li>string <em>$order</em></li>
<li>int <em>$recursive</em></li>
</ul>
<p>Returns the specified (or all if not specified) fields from the       <strong>first record</strong> that matches $conditions or FALSE if no data is found.  <em>Recursive </em>must be -1 to not return any associated data.</p>
<p>Example:<br />
<pre class="brush: php;">
$one_row = $this-&gt;ModelName-&gt;find('id = ' . clean_id,  null, null, -1);
</pre></p>
<p>Return example (i.e. value in $one_row):</p>
<blockquote></blockquote>
<pre><pre class="brush: php;">
Array
(
    [ModelName] =&gt; Array
        (
            [id] =&gt; 1000
            [name] =&gt; Ford
            [status] =&gt; A
            [created] =&gt; 2007-08-04 00:42:17
            [modified] =&gt; 2007-08-04 00:42:17
        )

)
</pre></pre>
<blockquote></blockquote>
<p>So to get the value of <em>name</em> to your view you could write:<br />
<pre class="brush: php;">
$this-&gt;set('name', $one_row['ModelName']['name']);
</pre></p>
<blockquote></blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sliceofcake.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sliceofcake.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sliceofcake.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sliceofcake.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sliceofcake.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sliceofcake.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sliceofcake.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sliceofcake.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sliceofcake.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sliceofcake.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sliceofcake.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sliceofcake.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sliceofcake.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sliceofcake.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sliceofcake.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sliceofcake.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sliceofcake.wordpress.com&amp;blog=1500549&amp;post=5&amp;subd=sliceofcake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sliceofcake.wordpress.com/2007/08/14/find-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/890e40cffc758ef06b0b8ca4a41298da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shawn</media:title>
		</media:content>
	</item>
	</channel>
</rss>
