Pagination, how to start with it?[SOLVED] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Pagination, how to start with it?[SOLVED] (/showthread.php?tid=67276) |
Pagination, how to start with it?[SOLVED] - kirasiris - 02-03-2017 Hello guys, I'm wondering how to do the pagination, as I followed the user guide I was expecting it to work as it says, but it did not. Any suggestion is goign to be very helpful, thank you. Can somebody explain to me what's the right way to use the pagination class? This is my controller(News, function blog): PHP Code: public function blog() This is my view (Blog) Code: <div class="container" id="main"> This is my pagination file(inside config folder): PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); I attached an image on this posrt as well. For some reason the pagination works in the url as "http://localhost/demo6/blog/?pages=2" and so on (this is good), but when I put it in the view it send an error: A PHP Error was encountered Severity: Notice Message: Undefined variable: pagination Filename: blog/index.php Line Number: 35 Backtrace: File: C:\xampp2\htdocs\demo6\application\views\news\blog\index.php Line: 35 Function: _error_handler File: C:\xampp2\htdocs\demo6\application\controllers\News.php Line: 66 Function: view File: C:\xampp2\htdocs\demo6\index.php Line: 315 Function: require_once RE: Pagination, how to start with it? - drub4n - 02-04-2017 There is no variable pagination sent to your view, you should do : in controller : Code: $this->data['pagination'] = $this->pagination->create_links(); And then $pagination will be accessible from within your view. Hope it helps |