Tag Archives: CakePHP

How cakephp support UTF-8

it’s very easily! for 1.1 or older ,add fllowing code to the constrctor of your add_model.php in your root’s directory .

parent::__construct($id, $table, $ds); $this->execute(“SET NAMES ‘UTF8′”); define(‘MYSQL_SET_NAMES_UTF8′, true);

for 1.2 ,so easy ,just add one line to config/database.php in your webapplication folder … Continue reading

Posted in CakePHP | Tagged , | Leave a comment

Writing a custom CakePHP console script

Add these codes to a file,and put it in the vendor folder

// vendors/shells/demo.php class DemoShell extends Shell { function initialize() { // empty } function main() { $this->out(’Demo Script’); $this->hr(); if (count($this->args) === 0) { $filename = $this->in(’Please enter the filename:’); } else { $filename = $this->args[0]; } $this->createFile(TMP.$filename, ‘Test content’); } function help() { $this->out(’Here … Continue reading

Posted in CakePHP | Tagged | Leave a comment