Some ideas what to use if you want to add some additional feature. Feel free to comment on this below. Level of Independence We need to ask ourselves if this feature needs to interact with other cake elements, like controller,…
Year: 2010
Tools Plugin – Part1: Token
In this first part of the presentation of my tools plugin I will show you how you can easily manage (store, retrieve, validate) "code keys" alias "tokens". They are useful in the registration process of users, or if you want…
Static Enums or “Semihardcoded Attributes”
There are many cases where an additional model + table + relation would be total overhead. Like those little "status", "level", "type", "color", "category" attributes. Often those attributes are implemented as "enums" in SQL – but cake doesn’t support them…
Working with forms
The Cookbook only covers the real basics. I want to go over some common issues in a more detailed way for Cake1.3 apps. Dummy Values Dummy values for select fields are usually added in the view: /* (1) */ echo…
Cake Bake: Custom Templates
The Problem The default templates of the "baking" process are not very useful for a productive environment. They are meant to rapidly produce working code for development purposes. This is actually great for that matter. But as soon as you…
CakePHP bootstrap goodies
A list of some things quite handy for every cake app and therefore best placed in the bootstrap.php as they are not (yet) part of the cake core. # Useful when putting a string together in PHP define('LF', PHP_EOL); define('NL',…
Validating multiple models at once
There are forms where you want to add/edit not only fields of the current model, but also of a related one (usually hasMany or belongsTo). Example: User and Post $this->Post->set($this->data); $this->Post->User->set($this->data); $val1 = $this->Post->validates(); $val2 = $this->Post->User->validates(); if ($val1 &&…
CakePHP and Subversion
A Quick How-To about properly setting up a svn for your cake app. First of all, we need to drop a "trunk" folder into our svn: /trunk inside this trunk, we now add /app (actual app) /vendors (global vendors) /cake…