There are many great IDEs for PHP development. One is PHPDesigner, which is mainly for windows. With some minor adjustments it works pretty well with cake. Preferences Go to: Tools -> Preferences [CTRL + E] General File Encoding: UTF8 Trim…
Saving Model Data and Security
In google groups there are quite a few discussions every month about security against (primary key) injection, xss or other things. And yes, the default templates will not protect you from any of this. They are meant to produce quick…
External links and the target attribute
I like external pages to open in a new window. So that my page stays open. But target attribute is deprecated. If you want to validate the XHTML pages, it would result in errors. The thought behind it was to…
Keeping track of users/guests
On the one hand, there is piwik and other tracking tools. But they usually only track "total users per day". If you want to track users in real time, you can easily set up something yourself. We need to set…
Necessary Core Hacks – Cake1.3
As of now there are some litte adjustments that are either necessary or at least very useful to apply I keep this list here up to date and will remove or add hacks if something changes (usually the cake team…
Useful hidden functions
There are some handy cake functions you might not have used or even heard of, yet. Debugging Most beginners use print_r() to debug variables. Without <pre> tags its really hard to read, though. Use pr($var) or debug($var) to debug this…
Development vs. Productive Setup
If you want to deploy your cakephp app you usually have to change a few lines of code. But we want to minimize that. My example setup: development: Windows (>= Vista) productive: Linux (Debian) Database Setup Create a library file…
How to implement Captchas properly
What is a captcha? They protect forms on websites from spammers and bots (@see Wikipedia for details). The main idea: Display some kind of code a human can easily read and submit but a computer can not. How NOT to…
Extended core validation rules
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…