Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create new helper in codeigniter

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 241
    Comment on it

    Codeigniter gives the facility to create own helper according to requirement. You can code easily and call inside the codeigniter controller or model.

    1) Create a file and put the following code into it.

    if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    if ( ! function_exists('test_method'))
    {
        function test_method($var = '')
        {
            return $var;
        }   
    }

    Save this to application/helpers/ "new_helper.php"

    2) Using the Helper
    First use the code as bellow to load the helper file.

    $this->load->helper('new_helper');
    

    3) Calling of method.

    echo $this->test_method('Hello World');
    

 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: