DRY: Applied to your setup

By Andy, filed under CakePHP, Tips

As pointed out in a recent comment, when changing your cake version you may find that some of your hand written config files are nolonger compatible with the version of cake you have selected. However by making use of a a custom production setup there is a way to configure your application defensively and in less lines of code.

Every time I use copy, paste &...

read more0 comments

  • Production setup revisited

    By Andy, filed under CakePHP, Tips

    A while ago I wrote about how to have a production setup on a shared host, an insightful comment from CraZyLeGs pointed out that the same idea could be extended (on either a shared of dedicated machine) to allow multiple applications to be installed on the same server, and have multiple parallel versions of cake installed as well. For some time, and in reality probably...

    read more6 comments

  • Production style on a shared host

    By Andy, filed under CakePHP, Tips

    Most websites written in cake will inevitably end up installed on a shared host. Shared hosts are a great compromise between freedom and cost but one of the things that you typically can't do is change the DocumentRoot (the physical directory on the server that corresponds to the url /). The manual explains how to change between a development (extract your cake files and...

    read more9 comments

  • Return of the Demos

    By Andy, filed under CakePHP, Tools, Tips, Plugins

    A brief not to say that I'll be putting a couple of Demos back on the site, and I'll be adding to the main demo page as I go. All of the demos will be put up as plugins.

    The pagination demo and source has always been available, and adding to that, the the next example is the Title tutorial. A very simple example based on the original tutorial from the wiki...

    read more11 comments

  • Change the config at run time

    By Andy, filed under CakePHP, Tools, Tips, Database

    Following on from my previous post, I thought I'd mention a similar use that can make a developers life a little easier. Usually when developing software there are at least 3 environments: Development, Test and Production. For larger projects there may be more, but for a simple website (and a tiny team of 1) there is often 2 environments: the one on the development machine...

    read more5 comments

  • One Database file - two servers

    By Andy, filed under CakePHP, Tips, Database

    If you have your website on one server for testing/development (like this laptop) and your live site on another, it's quite likely that once in a while your database.php file from one or the other will find itself referring to the wrong database. Over at With Cake a solution was proposed to allow you to switch database sources in the app model, however it might be easier to...

    read more5 comments

  • Prevent Robots from accessing an action

    By Andy, filed under CakePHP, Tips

    If, like on this site, you have some demo applications with some data in them, it's wise to try to ensure that the test data you spent an hour or two creating doesn't get deleted.

    For the demos that were on this site (they'll be coming back after some tweaking) I set up a script to run once per hour to truncate and reimport the test data - thus ensuring that malicious...

    read more2 comments

  • Plugins and Routes

    By Andy, filed under CakePHP, Tips, Plugins, Routes

    Routes are a great feature, but if you try using them with Plugins you might find that you start pulling your hair out. Fear not however, there's always a solution and it's usually not that difficult. If you use routes of the form below, you can map directly to a plugin's page:

    $Route->connect('/Something/*', array('controller' => 
    
    'PluginName', 'action' => 'ControllerName',...
    1. $Route->connect('/Something/*', array('controller' =>
    2. 'PluginName', 'action' => 'ControllerName',...

    read more0 comments

« 1 | 2