I18n Translation Some translate the rules in the view – but it usually creates redundancy. In some projects this might be intentional. I like to keep the error messages centralized, though. For that, you can just override the core translation…
Redirect Root Domain to WWW Subdomain
The Problem "When you have two different addresses pointing to the same page, like www.example.com/offers.html and example.com/offers.html, many search engines (or so we are led to believe) will treat those two URLs as two separate pages. When you, as a…
User Add Console Script
If you have a fresh setup of your app and no users in the database, its not easy to "register" a new one (with the admin role and everything). The other case would be if you changed the security salt….
Subversion and multiple CakePHP apps
A few days ago i already wrote about how to set up a svn for cake. In this second part i will cover the aspect of managing several apps. The Problem We have several apps, each with its own cake…
Code-Completion Console Script
Many good IDEs for Webdevelopment cannot automatically understand the structure of a framework and its classes/objects. They need a small file initializing the objects so that they know in which context they appear. E.g.: $this->Session (Session Helper) its impossible for…
Helper? Component? Lib?
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,…
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…