CakePHP: generate .po localization files using Shell


  Using the bake command, cakephp will read all your source files and it will extract all the text to translate. So it’s very important that you write the string in the i18n function and don’t pass just variables. For example to extract the text, using the command line go to you app directory, and execute … Continue reading CakePHP: generate .po localization files using Shell

CakePHP joining tables


In many cases when we want to formulate complex queries, that need joins between tables, we can still add joins on the fly by adding it to the call of find $students_of_grade = $this->User->find('list',array(             'fields'=>array('UserData.user_id'), 'joins'=>array(                      array(     … Continue reading CakePHP joining tables

CakePHP: change default model for a controller


By default a CakePHP controller uses a model with singularized name, for example a controller with name Students will use by default a model named Student, But if you want or have to change the default model for a controller you can set it using $modelClass member attribute for example for a controller named ClassesController … Continue reading CakePHP: change default model for a controller

CakePHP: Multilingual application using URL routes


Here is a simple tutorial on how to develop a multilingual cakephp application through URLs, After having as desired number of language translation files in /app/Locale we want to direct the application to direct the application to use each language through URL prefix like http://www.application.com/eng/pages/about/ and http://www.application.com/ara/articles/view/123 1- First add this route to the default … Continue reading CakePHP: Multilingual application using URL routes

How to disable browser cache in CakePHP


use the useful callback disableCache(), that will tell the user’s browser not to cache the results of the current request. This is different than view caching. The headers sent to this effect are: Expires: Mon, 26 Jul 1997 05:00:00 GMT Last-Modified: [current datetime] GMT Cache-Control: no-store, no-cache, must-revalidate Cache-Control: post-check=0, pre-check=0 Pragma: no-cache