<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-1297447001033312453</id><updated>2009-10-07T18:53:29.447-07:00</updated><title type='text'>CakePHP Findings</title><subtitle type='html'>Yet another blog devoted to development with CakePHP!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-5984145970735171330</id><published>2009-06-10T11:17:00.000-07:00</published><updated>2009-06-10T11:30:28.846-07:00</updated><title type='text'>CakePHP Flex and the CpAmf Plugin</title><content type='html'>Been trying to dive into more RIA development by learning Flex. In the process, I came across the following articles:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bakery.cakephp.org/articles/view/flex-remoting-with-cakephp-cpamf-plugin-1" target="_blank"&gt;Flex remoting with cakePHP - CpAmf plugin&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://carrotplant.com/en/blog/cpamf-flex-example" target="_blank"&gt;CpAmf Flex Example&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In this article it talks about VO (Value-Object) mapping. I was able to download the demo and get it all working great. However, when I tried to tackle this myself in my own application, I came up frustrated. The reason for this frustration was that apparently I don't read very well. In the article from &lt;a href="http://bakery.cakephp.org/" target="_blank"&gt;The Bakery&lt;/a&gt; it indicated the following.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;em&gt;&lt;br /&gt;In our model we create an afterFilter method, and use the cakePHP built in Set::Map() function to convert the associative array to an object (or array of objects). We use generic class here (php's dummy class 'stdClass'), set the _explicitType property of all objects, and unset the _name_ property (which is set by Set::Map() method), because we don't need this property in our flex class. This approach allows us to change the model, and the corresponding flex class without the need for changing the vo classes (we don't even need to create them).&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Well, after two days of fooling around with my controller to make this work, I ended up digging into the Model code from the demo project and found this little snippet:&lt;br /&gt;&lt;br /&gt;&lt;pre class="php" name="code"&gt;&lt;br /&gt; function afterFind( $results )&lt;br /&gt; {&lt;br /&gt;  //Convert the results to objects&lt;br /&gt;  $resultObjects = Set::map( $results );&lt;br /&gt;  foreach ( $resultObjects as &amp;$item )&lt;br /&gt;  {&lt;br /&gt;   // Set _explicitType for all objects,&lt;br /&gt;   // for correct mapping the object in flex&lt;br /&gt;   $item-&gt;_explicitType = $this-&gt;name;&lt;br /&gt;   &lt;br /&gt;   // We does not need the _name_ property, which is set automatically&lt;br /&gt;   // by the Set::Map() function when we use it without a class name&lt;br /&gt;   unset ( $item-&gt;_name_ );&lt;br /&gt;   &lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  return $resultObjects;  &lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Had I been reading the original article correctly, I would not have wasted all this time trying to figure this out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-5984145970735171330?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/5984145970735171330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2009/06/cakephp-flex-and-cpamf-plugin.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/5984145970735171330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/5984145970735171330'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2009/06/cakephp-flex-and-cpamf-plugin.html' title='CakePHP Flex and the CpAmf Plugin'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-4822850734477108617</id><published>2009-01-22T06:36:00.000-08:00</published><updated>2009-01-22T06:38:36.397-08:00</updated><title type='text'>Quick Tip - Doing Ad-hoc Joins in Model::find()</title><content type='html'>Where was this 5 days ago when I needed it for a project? This is a whole lot better than using bind() and unbind().&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find"&gt;Quick Tip - Doing Ad-hoc Joins in Model::find()&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-4822850734477108617?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/4822850734477108617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2009/01/quick-tip-doing-ad-hoc-joins-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/4822850734477108617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/4822850734477108617'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2009/01/quick-tip-doing-ad-hoc-joins-in.html' title='Quick Tip - Doing Ad-hoc Joins in Model::find()'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-3412270000751496183</id><published>2008-11-21T20:29:00.001-08:00</published><updated>2008-11-21T20:58:18.923-08:00</updated><title type='text'>Sementation fault with $uses variable in app_controller</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;Tonight, my Apache instance (OSX 10.5.5 Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 PHP/5.2.5 ) threw a segmentation fault when I tried to use one of my Models from the app_controller. In my code, this is how I had this setup:&lt;br /&gt;&lt;br /&gt;&lt;pre class="php" name="code"&gt;&lt;br /&gt;class AppController extends Controller {&lt;br /&gt;   var $helpers = array('Html', 'Javascript', 'ForLayout', 'Tree');&lt;br /&gt;   var $components = array('Session', 'obAuth', 'Cookie');&lt;br /&gt;   var $uses = array('Contentpage'); /* THIS IS THE OFFENDING LINE */&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I discovered this by systematically commenting out every piece of code that was implementing my Contentpage model. When I commented out the $uses variable, the segmentation fault went away.&lt;br /&gt;&lt;br /&gt;So now my code reads like this to remind me.&lt;br /&gt;&lt;br /&gt;&lt;pre class="php" name="code"&gt;&lt;br /&gt;class AppController extends Controller {&lt;br /&gt;   var $helpers = array('Html', 'Javascript', 'ForLayout', 'Tree');&lt;br /&gt;   var $components = array('Session', 'obAuth', 'Cookie');&lt;br /&gt;   /*&lt;br /&gt;    * WARNING!!! THIS CAUSES A SEGMENTATION FAULT!! DO NOT USE!!!&lt;br /&gt;    * var $uses = array('Contentpage');&lt;br /&gt;    *&lt;br /&gt;    */&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I've seen some issues in the CakePHP trac regarding segmentation faults, but nothing of this exact same nature.&lt;br /&gt;&lt;br /&gt;As a side note, I thought I would try to use it from another controller. Initially this worked fine, but when it ran functions inside of obAuth, I got very unpredictable results. I'm still not really sure exactly what the nature of that error was. While I was debugging this, the segmentation fault started up again.&lt;br /&gt;&lt;br /&gt;At any rate, I found a way to work around this so it doesn't hinder my work by putting a different layout on the controllers and actions that I originally wanted this functionality to execute on. However, I'm not sure what I'll do if I need a Model available to the app controller.&lt;br /&gt;&lt;br /&gt;Has anyone else had this issue?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-3412270000751496183?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/3412270000751496183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/sementation-fault-with-uses-variable-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/3412270000751496183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/3412270000751496183'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/sementation-fault-with-uses-variable-in.html' title='Sementation fault with $uses variable in app_controller'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-280798147166164927</id><published>2008-11-19T17:30:00.001-08:00</published><updated>2008-11-19T17:30:11.875-08:00</updated><title type='text'>Define your own "for_layout" variables</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Was looking for a way to add variables called $keywords_for_layout and $description_for_layout to provide meta data in my default layout page and I came across this from cakebaker. After I fought off the urge to set these fields in my controller all went well.&lt;br/&gt;&lt;br/&gt;&lt;a href='http://cakebaker.42dh.com/2007/04/28/define-your-own-for_layout-variables/'&gt;Define your own “for_layout” variables - cakebaker&lt;/a&gt;&lt;br/&gt;&lt;blockquote/&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-280798147166164927?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/280798147166164927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/define-your-own-variables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/280798147166164927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/280798147166164927'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/define-your-own-variables.html' title='Define your own &amp;quot;for_layout&amp;quot; variables'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-2566538868782491483</id><published>2008-11-13T08:37:00.001-08:00</published><updated>2008-11-13T08:37:08.969-08:00</updated><title type='text'>Acl/Auth vs. obAuth</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Just spent the better part of a frustrating week dealing with the over-discussed and under documented Acl/Auth built into CakePHP 1.2. I finally threw up my hands in disgust even after I figured out how the whole system worked. I wanted to have granular control over my actions in my controllers and after I finally figured out that I had to have "all" my actions listed under my aco tree, I still got errors when I tried to log out of the application that my "logout" task was not properly mapped. All that time to figure out how to do this the out-of-the-box, Cake way only to hit yet another wall. &lt;br/&gt;&lt;br/&gt;Finally, I passed the point in my project where I can no longer be held up with this and reverted to my old and dear friend &lt;a href='http://bakery.cakephp.org/articles/view/obauth-component-tutorial' target='_blank'&gt;obAuth&lt;/a&gt;. I had this configured in my 1.1 projects so I had all of this functionality outlined and in about 30 minutes, I had the authentication working with this simple batch of code in my app_controller.&lt;br/&gt;&lt;br/&gt;&lt;pre class='php' name='code'&gt;	....&amp;lt;br /&amp;gt;	var $components = array('obAuth');&amp;lt;br /&amp;gt;	function beforeFilter() {&amp;lt;br /&amp;gt;		$this-&amp;gt;obAuth-&amp;gt;startup($this);&amp;lt;br /&amp;gt;		if(isset($this-&amp;gt;params['admin'])){&amp;lt;br /&amp;gt;			switch($this-&amp;gt;params['controller']) {&amp;lt;br /&amp;gt;				case 'groups':&amp;lt;br /&amp;gt;				case 'pagetypes':&amp;lt;br /&amp;gt;				case 'states':&amp;lt;br /&amp;gt;				case 'countries':&amp;lt;br /&amp;gt;				case 'types':&amp;lt;br /&amp;gt;				case 'challenges':&amp;lt;br /&amp;gt;					$this-&amp;gt;obAuth-&amp;gt;lock(array(ADMINISTRATOR)); // This is defined in core.php&amp;lt;br /&amp;gt;					break;&amp;lt;br /&amp;gt;				default:&amp;lt;br /&amp;gt;					$this-&amp;gt;obAuth-&amp;gt;lock(array(ADMINISTRATOR, WEBMASTER)); // These are  defined in core.php&amp;lt;br /&amp;gt;			}&amp;lt;br /&amp;gt;			&amp;lt;br /&amp;gt;		}&amp;lt;br /&amp;gt;	}&amp;lt;br /&amp;gt;...&amp;lt;br /&amp;gt;&lt;/pre&gt;&lt;br/&gt;&lt;br/&gt;If I have this to do over again, I would probably look into setting the permissions on the controller level with ACL and then using the "controller" or "crud" as the action on $this-&amp;gt;Auth-&amp;gt;authorize. This is the way most people that have gotten it to work are successful with it. The most helpful site on this is &lt;a href='http://aranworld.com/article/161/cakephp-acl-tutorial-what-is-it'&gt;Aran Johnson's site at Aran World&lt;/a&gt;. His &lt;a href='http://aranworld.com/article/161/cakephp-acl-tutorial-what-is-it'&gt;sample kitchen web site&lt;/a&gt; gave me a lot of useful tips on how to work through the Auth part of this and as long as I stayed close to the demo code and didn't stray, I could make it work.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-2566538868782491483?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/2566538868782491483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/aclauth-vs-obauth.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/2566538868782491483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/2566538868782491483'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/aclauth-vs-obauth.html' title='Acl/Auth vs. obAuth'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-6365050016421606680</id><published>2008-11-09T19:28:00.001-08:00</published><updated>2008-11-09T19:28:48.381-08:00</updated><title type='text'>CakePHP Useful links Catch-All from PseudoCoder.com</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Just found this great list of links to all kinds of articles related to CakePHP. I have most of them already bookmarked, but I didn't want to lose this page.&lt;br/&gt;&lt;br/&gt;&lt;a href='http://www.pseudocoder.com/archives/2008/02/10/cakephp-tutorials/'&gt;CakePHP Tutorials :: PseudoCoder.com&lt;/a&gt;&lt;br/&gt;&lt;blockquote/&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-6365050016421606680?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/6365050016421606680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/cakephp-useful-links-catch-all-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/6365050016421606680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/6365050016421606680'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/cakephp-useful-links-catch-all-from.html' title='CakePHP Useful links Catch-All from PseudoCoder.com'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-1111264650597976541</id><published>2008-11-04T20:34:00.001-08:00</published><updated>2008-11-04T20:38:19.288-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='behavior'/><category scheme='http://www.blogger.com/atom/ns#' term='drag and drop'/><category scheme='http://www.blogger.com/atom/ns#' term='acts as tree'/><category scheme='http://www.blogger.com/atom/ns#' term='cakephp1.2'/><title type='text'>Tree Drag and Drop with CakePHP</title><content type='html'>My goal is to use this along with the Tree behavior for what I'm building. Ideally, I'd like to find a similar JQuery solution for this as I'm trying to move all my code the the JQuery framework.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://realm3.com/articles/drag_and_drop_trees_with_cakephp"&gt;realm3: Drag and Drop Trees With CakePHP&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-1111264650597976541?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/1111264650597976541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/tree-drag-and-drop-with-cakephp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/1111264650597976541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/1111264650597976541'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/tree-drag-and-drop-with-cakephp.html' title='Tree Drag and Drop with CakePHP'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-5021754638888296204</id><published>2008-11-03T19:52:00.000-08:00</published><updated>2008-11-04T06:17:21.111-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='default'/><category scheme='http://www.blogger.com/atom/ns#' term='updated'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='modified'/><category scheme='http://www.blogger.com/atom/ns#' term='automagic'/><category scheme='http://www.blogger.com/atom/ns#' term='created'/><title type='text'>CakePHP Model’s created / modified gotcha!</title><content type='html'>My created and modified fields were not updated in my database tables. I had painstakingly set them up with default values of '0000-00-00 00:00:00' and had them set (incorrectly, GRR!) to be not null. I thought that seemed strange as in my previous experience these fields always updated automagically. Then, I stumbled upon this little gem.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sanisoft.com/blog/2007/06/15/cakephp-models-created-modified-gotcha/"&gt;SANIsoft - PHP for E Biz» Blog Archive » CakePHP Model’s created / modified gotcha!&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now, I'm off to the work to change all these fields in all my tables. Ah, the joys of programming!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-5021754638888296204?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/5021754638888296204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/cakephp-models-created-modified-gotcha.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/5021754638888296204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/5021754638888296204'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/cakephp-models-created-modified-gotcha.html' title='CakePHP Model’s created / modified gotcha!'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-3819607080642417387</id><published>2008-11-03T19:23:00.000-08:00</published><updated>2008-11-04T06:18:21.507-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='combobox'/><category scheme='http://www.blogger.com/atom/ns#' term='input'/><category scheme='http://www.blogger.com/atom/ns#' term='find'/><category scheme='http://www.blogger.com/atom/ns#' term='list'/><category scheme='http://www.blogger.com/atom/ns#' term='FormHelper'/><category scheme='http://www.blogger.com/atom/ns#' term='drop-down'/><title type='text'>List displays with a blank option using FormHelper input</title><content type='html'>I just discovered a super easy way to generate a drop-down choice of related fields in CakePHP1.2.&lt;br /&gt;&lt;br /&gt;This code in my controller:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="php"&gt;&lt;br /&gt;$pagetypes = $this-&gt;Contentpage-&gt;Pagetype-&gt;find('list');&lt;br /&gt;$this-&gt;set(compact('pagetypes'));&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Coupled with this code in my view:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="php"&gt;&lt;br /&gt;$form-&gt;input('pagetype_id');&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Generates a select box with all my Pagetype options filled automagically. In addition, this remains stateful when I return to edit this.&lt;br /&gt;&lt;br /&gt;This is such an improvement over older versions of CakePHP and what I've had to done in Ruby on Rails in the past.&lt;br /&gt;&lt;br /&gt;One problem that this posed to me was getting a blank field or a field that prompted the user with a "Please select..." message. I knew there had to be a way to do this, so with a little fishing in &lt;a href="http://groups.google.com/group/cake-php/browse_thread/thread/91eeeec5caf49872"&gt;Google's CakePHP Group&lt;/a&gt;, I came upon this answer:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;To deliver a simple blank space in the drop-down:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="php"&gt;&lt;br /&gt;$form-&gt;input('pagetype_id', array('empty' =&gt; true));&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;To deliver a "Please Select..." (or whatever you want) in the drop-down:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="php"&gt;&lt;br /&gt;$form-&gt;input('pagetype_id', array('empty' =&gt; 'Please Select...'));&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That's all there is to it! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-3819607080642417387?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/3819607080642417387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/list-displays-with-blank-option-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/3819607080642417387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/3819607080642417387'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/list-displays-with-blank-option-using.html' title='List displays with a blank option using FormHelper input'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-2758575813685441905</id><published>2008-11-03T19:02:00.000-08:00</published><updated>2008-11-04T06:19:23.579-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='controller'/><category scheme='http://www.blogger.com/atom/ns#' term='layouts'/><title type='text'>Undefined variable: javascript (..default.ctp)</title><content type='html'>This error was causing me fits as it was not really throwing an error on the screen, only in my debug.log. What I found was that  this was coming from not having my reference in the right controller. Each of my controllers had a similar reference:&lt;br /&gt;&lt;pre name="code" class="php"&gt;&lt;br /&gt;class FaqsController extends AppController {&lt;br /&gt;  var $name = 'Faqs';&lt;br /&gt;  var $helpers = array('Html', 'Form', 'Javascript', 'Fck');&lt;br /&gt;....&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The error I was seeing was being generated by my default layout. All I had to do to fix this was put the following in my app_controller.php file.&lt;br /&gt;&lt;pre name="code" class="php"&gt;&lt;br /&gt;class AppController extends Controller {&lt;br /&gt; var $helpers = array('Html', 'Javascript');&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Thanks to the &lt;a href="http://www.vtek.nl/"&gt;V-TEK Channel blog&lt;/a&gt; and &lt;a href="http://www.vtek.nl/undefined-variable-javascript-in-cakephp-with-scriptaculous_programmeren_120.htm"&gt;this link&lt;/a&gt; for pointing me in the right direction.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-2758575813685441905?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/2758575813685441905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/undefined-variable-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/2758575813685441905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/2758575813685441905'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/undefined-variable-javascript.html' title='Undefined variable: javascript (..default.ctp)'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1297447001033312453.post-1827805868173702279</id><published>2008-11-03T18:46:00.000-08:00</published><updated>2008-11-04T05:18:52.458-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cincinnati'/><category scheme='http://www.blogger.com/atom/ns#' term='wondergroup'/><category scheme='http://www.blogger.com/atom/ns#' term='cakephp1.2'/><title type='text'>CakePHP Findings Blog</title><content type='html'>Hello all! I'm starting this blog to chronicle things I find related to development in CakePHP 1.2. I hope to collect my findings in this location through code snippets, URL references and framework pieces I find that work for me in my development of CMS-based applications for &lt;a href="http://www.wondergroup.com"&gt;WonderGroup&lt;/a&gt; in Cincinnati, Ohio.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1297447001033312453-1827805868173702279?l=cakephpfindings.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cakephpfindings.blogspot.com/feeds/1827805868173702279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/cakephp-findings-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/1827805868173702279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1297447001033312453/posts/default/1827805868173702279'/><link rel='alternate' type='text/html' href='http://cakephpfindings.blogspot.com/2008/11/cakephp-findings-blog.html' title='CakePHP Findings Blog'/><author><name>Russell Griffith</name><uri>http://www.blogger.com/profile/08910252330386883456</uri><email>russell.griffith@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='00680655022402482098'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>