RSS Feed

Words of Wisdom from Pierre Martin

  • i18n routes with CakePHP 1.3

    August 05 2010 | Pierre Martin |

    Internationalizing a CakePHP application can be tricky when it comes to deal with i18n urls. We will see in this article how the Custom route classes introduced by CakePHP 1.3 could be used to add the current language to your urls in a few lines of code. Requirements This article will not go too deep in internationalizing an application as many resources already exist about it. We suppose the following: Your application defines the current language on given the language code passed in the url The available languages are configured via Configure::write('Config.languages', array('eng', 'fre', 'deu')); You use the CakePHP array syntax for defining urls: $this->Html->link('link', array('controller' => 'posts', 'action' => 'view', $post['Post']['id'])); $this->redirect(array('controller' => 'posts', 'action' => 'index')); Router::url(array('controller' => 'posts', 'actio...

    [ Read More | 0 Comments ]

  • Quick start with Migrations plugin

    March 01 2010 | Pierre Martin |

    In a previous post I gave an overview of the CakePHP Migrations plugin, what it does and why you should use it in your applications. This article will explain how to use it in a practical way. We are going to bake a simple blog application recipe application and see how migrations are integrated in the development process. Since we recently moved all our open source projects on http://cakedc.github.com/, this sample application source code is also available there: Sample Migrations Application - Github (it is a CakePHP 1.3 application). Ready? Bake a new application and add the migrations plugin First of all, we need to bake a new CakePHP application. Easy enough to do using cake bake, then configure your database (an empty database is sufficient for now) and check that the home page is all green! If you have not set up your environment to use the CakePHP command line yet, take so...

    [ Read More | 0 Comments ]

  • CakePHP Migrations plugin: easily version and deploy whole applications

    February 05 2010 | Pierre Martin |

    This article is a quick introduction to the Migrations plugin, open sourced a few weeks ago by our company. You will see how simple it is to use the plugin and what you could do with it. I hope this article will show you the benefits of using migrations in your CakePHP applications and make you give it a try right after the reading! Here is a one-sentence description of the plugin: the Migrations plugin allows developers to easily version and automate the creation / update process of any database schema and application data from the command line. For information, CakeDC uses this plugin on its project since several years to make team collaboration and deployment easier. The plugin has been entirely rewritten a few months ago and fully tested (code coverage >95% as always at CakeDC) before being open sourced under the MIT license. It is now available to the community along with its d...

    [ Read More | 0 Comments ]