CakePHP for Web Designers

URL Structure http://<server-path>/[controller]/[action] Key Folders > View/[Controller]/[action].ctp > View/Layout/default.ctp > View/Element/[element-name].ctp > webroot/js > webroot/css > webroot/img HTML Templates are view (.ctp) files. Quick Guide to View (.ctp) Files    Code Explanation <?= $this->Html->script(‘filename’) ?> Include the javascript file “webroot/js/filename.js” <?= $this->Html->css(‘filename’) ?>  Include the css file “webroot/css/filename.css”  <?= $this->Html->link() … Read More

CakePHP MongoDB setup

Install PHP Install MongoDB Extension Reference - On Windows, simply grab the DLL and include the extension On Linux, install php-pear and then run “pecl install mongo” Get CakePHP Get CakePHP MongoDB Plugin  ( Install MongoDB Reference - On Windows – Simply download and extract the folder On Linux – … Read More

CKEditor elFinder on CakePHP

Below is recommended approach for using elFinder with CKEditor in CakePHP Create folder ‘packages’ under ‘webroot’. Download elfinder release package from here or create minified package as given here. Extract the elfinder folder under packages such that you have webroot/packages/elfinder/elfinder.html Create a controller action elfinder_browser() and corresponding view file as … Read More

Best of strtotime

Example $last_month_end = date(‘Y-m-d’, strtotime(‘last day of last month’); Useful Texts for Date calculations now today yesterday last day 2 days ago last week last month first day of last month last day of last month first day of next month last day of next month More references – … Read More

CakePHP 2.x Reset/Encrypt Password in MySQL

Simple steps: Find out the Security.salt value from app/Config/core.php (Let’s say ‘abc123′) Choose your password (Let’s say “MYPASSWORD”) Prefix salt to your password (‘abc123MYPASSWORD’). Use this in below MySQL command to get the encrypted password. update users set password = SHA1(‘abc123MYPASSWORD’) where id = 1; To encrypt all existing passwords: … Read More