[eluser]Michal1[/eluser]
Hello guys, I am trying to learn something about pagination and it works really nice when I have it setup in my index function in the main controller.
However I want to make a special function for this in the main controller, so it would look little bit more cleaner. But I get an error.
What I have is:
Code:
class Site extends Controller {
function index()
{
blablabla some coding and working with data array and models blablabla
$this->load->view('site_view',$data);
}
function paginate()
{
$this->load->library('pagination');
$config['base_url'] = 'http://127.0.0.1:8888/index.php/site/paginate';
$config['total_rows'] = '20';
$this->pagination->initialize($config);
$this->load->view('site_view');
}
}
Then in the site_view I have
Code:
<?php echo $this->pagination->create_links(); ?>
But it says
Code:
Message: Undefined property: CI_Loader::$pagination
Fatal error: Call to a member function create_links() on a non-object in C:\Program Files\EasyPHP-5.3.3.1\www\application\views\site_view.php on line 23
Do you think somebody could explain that to me? As I am beginner. when i put into index function it works fine. I do not get it.
Thank you