Current musing:

Using contenteditable to test css page layouts

This should be obvious, but I just realized that one could use the the HTML5 contenteditable feature to test page layouts. “Contenteditable” is a fancy little tag attribute that allows the user to edit the content contained in the element from the browser.

For example, Read more…

downloads

These guides are free, but if you have found them useful then please consider donating $2. Hey, that's less then the cup of coffee your drinking right?

subscriptions

« Blog home
15 helpful CakePHP tips, plus a few more.

Here’s a link to 15 essential CakePHP tips. They are extremely helpful. Tips #1 and #2 alone are worth the look. (hint: these tips explain why save() “mysteriously” stops working. It’s probably because of validation conflicts. E.g. when you are trying to update only a few model fields and but have other fields marked as “required”. This happened to me while I was creating a change password form. My form only had three fields: old password, new password, and retype new password; but my validation rules for the User model said that a username was required, thus validation failed without a warning.)

I’ve only been working with CakePHP for a little more than 3 weeks but I’ve learned a few good tips of my own. Please comment to correct my noob misconceptions!

  1. Temporarily turn off validation rules in a controller. save() isn’t working for you because of the problem cited above? then use the following code to temporarily bypass individual validation requirements.
    unset($this->Model->validate['fieldname']);
  2. See the entire structure of variables passed to your view from your controllers: The following code prints a very nicely formatted view of the entire array:
    In your controller:
    $this->set('variable','value');
    In your view:
    pr($variable);
  3. Join the crowd in IRC! man those folks are helpful! (Colloquy is a fantastic free IRC client for Mac, Windows users, let me know in the comments what’s good!)
  4. More will be forth coming as I think of them!