Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • how to create custom helpers in cakephp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 39
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: