zen of coding

A cleaner way to send emails

CakePHP 1.2 provides a very easy way to send emails using the built-in Email component. However, sending emails directly from your User’s controller add action, for example, is somewhat ugly. It’s better to write a custom method in your app controller to handle the sending of emails. Here’s an example, add[…]

Read More »

Use app controller to keep static list data

In the past I’ve often kept some data such as a list of states or countries in the DB and used that to populate my forms. After some random thinking I’ve found no good reason to utilize the DB for such a thing. This kind of a list is not very[…]

Read More »

Styling the paginator links

A little trick to make your paginator links look pretty… Add a ‘class’ option to your paginator links like so: [sourcecode language=’php’]

Read More »

Default helpers

Just a little tip… In CakePHP 1.2 (at least the recent versions) Form and Html helpers are included by default. Therefore you can save yourself some typing and no longer have to bother with including them manually. However, if you decide to add additional helpers in the App Controller, you still[…]

Read More »

Goodbye vendor()

Looks like in the recent versions of CakePHP 1.2 the use of the vendor() method has been deprecated. Instead you are supposed to use App::import(). The syntax however, is very clunky and I really wish vendor() would remain as is. Maybe it will be changed back to something more user-friendly[…]

Read More »
%d bloggers like this: