If knowledge is power, then sharing knowledge is ultimate powertrip
Latest Updates
You are here: Home >> Tag Archives: CakePhp

Tag Archives: CakePhp

Feed Subscription

Access model from controller

access_model_controller

Sometimes, or very rarely we might need to access model from controller or AppController (Application Controller). This could be for fetching values from a table and make it available for all the controllers in the application (AppController is inherited by all the other controllers). Also, often we need to access models that are not associated with a controller. I faced ... Read More »

Self join in CakePHP

I tried to explain how to do a self join in CakePHP I use this in my Gallery Model: var $hasMany = array( ‘Galleries’ => array( ‘className’ => ‘Gallery’, ‘order’ => ‘Galleries.ord ASC’, ‘foreignKey’ => ‘parent_id’)); var $belongsTo = array( ‘Galleries’ => array( ‘className’ => ‘Gallery’, ‘order’ => ‘Galleries.ord ASC’, ‘foreignKey’ => ‘parent_id’)); First, note the ‘Galleries’ (you change that ... Read More »

cakephp include javascript file in view

You probably know that if you have $scripts_for_layout in your site’s layout, then you can do a Cakephp include javascript file in view. For example, if you’d like to include ‘myScript.js’ from some view you would add the following code: $javascript->link(‘myScript’, false); Basically the second param (false), will tell CakePHP not to include the file in-line, but rather where the ... Read More »

CakePHP email handler

CakePhp email handler ’emailComponent’ (cakelibscontrollercomponentsemail.php) is a way for you to using the same concepts of layouts and view ctp files to send formatted messages as text, html or both. It supports sending via the built in mail functions of PHP, via smtp server or a debug mode where it writes the message out to a session flash message. It ... Read More »

Scroll To Top