CodeIgniter Forums
Can you check my pagination?[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: Can you check my pagination?[SOLVED] (/showthread.php?tid=67307)

Pages: 1 2


RE: Can you check my pagination? - kirasiris - 02-10-2017

(02-10-2017, 10:01 PM)pdthinh Wrote:
(02-10-2017, 12:50 PM)kirasiris Wrote: Ok, I did that as well, but it now shows just one entry, and apparently the same id. Basically it just showing one item rather than one different per page

Comment these two lines in your blog() may work:
PHP Code:
    // $config['query_string_segment'] = 'paginas';
 
   // $config['page_query_string'] = TRUE; 

Not to offend, but that was the first thing that I tried. It do not works(it changes the URL)

from:
http://localhost/demo6/blog/?page=1
to:
http://localhost/demo6/blog/1 (and so on)

It gives me a 404 error. Should I do something to the "routes" file?

Thanks for trying to help


RE: Can you check my pagination? - pdthinh - 02-10-2017

PHP Code:
// $config['query_string_segment'] = 'paginas';
// $config['page_query_string'] = TRUE; 

If your controller is news and method is blog(), so the the route should like:

PHP Code:
// $route['blog'] = 'news/blog/index'; // comment this line to test
$route['blog/(:num)'] = 'news/blog/$1'
// $route['blog/(:any)'] = 'blog/view/$1'; // also comment this line 



RE: Can you check my pagination?[Solved] - kirasiris - 02-10-2017

(02-10-2017, 11:14 PM)pdthinh Wrote:
PHP Code:
// $config['query_string_segment'] = 'paginas';
// $config['page_query_string'] = TRUE; 

If your controller is news and method is blog(), so the the route should like:

PHP Code:
// $route['blog'] = 'news/blog/index'; // comment this line to test
$route['blog/(:num)'] = 'news/blog/$1'
// $route['blog/(:any)'] = 'blog/view/$1'; // also comment this line 

Hey, it's working now :Smile Thanks  so much, I've been trying to figure out what was the problem with it. and finally you came out with it.
I could have done it by myself, but I never thougt that it was going to be just about changing the route file.