Daud Oladipo
Daud Oladipo

Reputation: 63

How to assess codeigniter helpers from external library

please help me with the below code. I'm trying to assess base_url helper from Mylib(external library)

Class Mylib{
    public function url() {
        $ci = &get_instance();
        $ci->load->helper('url');
        return base_url();
    }
}

Upvotes: 1

Views: 95

Answers (1)

Abdulla Nilam
Abdulla Nilam

Reputation: 38584

No its works fine. Check this.

class Mylib {

    protected $CI;

    public function __construct()
    {
        $this->CI =& get_instance();
    }

    public function url(){
        this->CI->load->helper('url');
        redirect();
    }

}

Upvotes: 1

Related Questions