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
Month: November 2012
How to check installation is either 32 bit or 64 bit ? you can simply type in terminal: getconf LONG_BIT It should result 32 or 64
you may think as the best way to check a string has HTML tags is to check the string after stripping tags: if( strlen($string) != strlen(strip_tags($string)) ){ echo 'Contains HTML tags'; } But, the best way is to use regular expressions: if (preg_match("/([\<])([^\>]{1,})*([\>])/i", $string )) { echo 'Contains HTML tags'; }
In CakePHP it is pretty easy to change the way that users reach to a specific action to another beautiful URL for ex: you may have a page that contains category details, and users reach to it via: http://domain.com/categories/view/id controller is "categories", action is "view", and it takes 1 parameter id and you may want … Continue reading CakePHP: Custom routes and pagination