CakePHP Image Helper

I’ve rewritten my image helper to extend off of CakePHP’s built in HTML helper, rather than reinvent the wheel. The major benefit of using this helper is that it determines the image dimensions, if not specified, and applies them to the image tag, which is one of Google’s rules to optimize browser rendering. <?php/** * This… Continue reading CakePHP Image Helper

Published
Categorized as CakePHP

CakePHP HasAndBelongsToMany (HABTM) Checkboxes Instead of Multiple Select

Changing CakePHP’s default multiple select for HasAndBelongsToMany (HABTM) relationships to use multiple checkboxes used to be an arduous task. It is now a simple option as follows. If you have a Post model that has a HABTM relationship with a Tag model, you would use the following line to display multiple checkboxes instead of the… Continue reading CakePHP HasAndBelongsToMany (HABTM) Checkboxes Instead of Multiple Select

Published
Categorized as CakePHP

Akismet API Component for CakePHP 1.2

This is a component for CakePHP 1.2 and PHP 5+ that utilizes the Akismet API to fight comment SPAM. You will need an API key, which can be retrieved from wordpress.com. <?php/** * This is a component for CakePHP that utilizes the Akismet API *  * See http://akismet.com/development/api/ for more information. *  * Licensed under The MIT License *… Continue reading Akismet API Component for CakePHP 1.2

Published
Categorized as CakePHP

CakePHP Reverse Routing

CakePHP provides a very strong and flexible routing engine, for both routing, and reverse routing. Creating a route for the home page is as simple as adding the following line to your routes.php configuration file. Router::connect(‘/about_us’, array(‘controller’ => ‘pages’, ‘action’ => ‘display’, ‘about_us’)); Now, anyone visiting http://example.com/about_us page, will see the view defined in your… Continue reading CakePHP Reverse Routing

Published
Categorized as CakePHP

Image Resizing Class

This is a simple script to resize images with PHP. It uses the GD Library functions, and is currently not compatible with ImageMagick. It will automatically determine the image type and use the appropriate functions to resize. <?php/** * This class handles image resizing. It will automatically determine the image * type and use the appropriate php… Continue reading Image Resizing Class

Published
Categorized as CakePHP

CakePHP Upgrade from 1.1 to 1.2

CakePHP 1.2 has finally released, but how do you upgrade site your site running CakePHP 1.1? It is a fairly simple process with brief formal instructions on cakephp.org. Most will only have to make a few changes as CakePHP 1.2 is not backwards compatible. All of the html helper form element methods have been moved… Continue reading CakePHP Upgrade from 1.1 to 1.2

Published
Categorized as CakePHP