If you got this error message you should
check have you extended the CI_controller first. Such as text in yellow
background below:
class index extends CI_Controller {}
If you have checked you have extended the
CI_controller but still got “Undefined property: index::$load” error. You should
try adding the class constructor to your code,
Here is my example case:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');class index extends CI_Controller {public function index(){$this->load->view(‘home’);}}
Add text in green:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');class index extends CI_Controller {public function __construct(){
parent::__construct();
// Your own constructor code
}public function index() {$this->data['template'] = "dynamic/home";$this->data['pagetitle'] = "home";$this->load->view(‘home’);}}
Reference:
CodeIgniter Version 2.2.0
No comments :
Post a Comment