Helpers is a classes which contains presentation logic that is shared between many views,layouts and elements.
First need to create helper file which must be stored inside app/Helper/EntriesHelper.php
App::uses('AppHelper', 'View/Helper');
class MycustomHelper extends AppHelper {
public function __construct(View $view, $settings = array()) {
parent::__construct($view, $settings);
}
create your function here
}
Next step is to add helpers array in controller
class MycustomController extends AppController {
public $helpers = array('Form', 'Html', 'Js', 'Time', 'Mycustom');
}
Next step is to call your helpers like thsi
$this->Helpers->load('Entries');
0 Comment(s)