Reputation: 134
Here is the controller ....
public function viewdeals (){
$this ->load-> model ('model_dealview');
if ( $q1 = $this-> model_dealview-> getdeals()){
$this->load->library('pagination');
$config['base_url'] = 'formalert/viewdeals';
$config['total_rows'] = 40;
$config['per_page'] = 5;
$this->pagination->initialize($config);
$q1['pagination'] = $this->pagination->create_links();
$this -> load -> view ('view_deals', $q1);
}
The problem is that whenever I try to run this with pagination ... i get this error
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Contoller_name::$pagination
Fatal error: Call to a member function initialize() on a non-object in
C:\wamp\www\ci\application\controllers\controllerfile_name.php on line 108
Everything works fine without pagination ...
I have tried loading library in cofig file ... done pretty much everything .. even copied code from the internet that work for other people .. Need help! ...
Please note its not identifying the property $pagination
... so other small problems in teh code won't matter.
Upvotes: 2
Views: 1965
Reputation: 134
Ok problem solved. You need to autoload the pagination library... just loading it in the function will not do.
Upvotes: 1