CodeIgniter Forums
Pagination : Page One Params Issue - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: Pagination : Page One Params Issue (/showthread.php?tid=66933)



Pagination : Page One Params Issue - Jurden - 12-20-2016

Hello,

I'm using the Pagination class and there is an issue on the first link (to page one).
Variables (or suffix) disapear on it.

If I'm only using

PHP Code:
$config['suffix'] = $request'urls' ]; 

Every links are set except the page one.

If I only use
PHP Code:
$config['reuse_query_string'] = true
Every links work.

So as I start with POST variables, I have to do my own pagination system or I miss something ?


RE: Pagination : Page One Params Issue - Diederik - 12-20-2016

You can overrule the first link in the config:
PHP Code:
$config['base_url' 'http://example.com/index.php/test/page/';
$config['first_url'] = 'http://example.com/index.php/test/page/1'



RE: Pagination : Page One Params Issue - Jurden - 12-20-2016

Thanks Diederik.
I will use this hack.

But someone know why this issue exist since 2012 (at least) and how this variable is normaly used to ?


RE: Pagination : Page One Params Issue - Diederik - 12-20-2016

You can't call using an existing (and documented) configuration option a hack, but ok Wink

Normally I would want my URL structure like this:

http://example.com/index.php/news (latest display the latest 25 items)
http://example.com/index.php/news/page/2 (latest display the 25-50 items)
etc

Just for SEO purposes I like to keep my URL's clean and short so I can use /news in my main navigation instead of /news/pages/1.

In my (public) news controller I would use:
PHP Code:
public function __construct()
    {

        
parent::__construct();

        
// configure your pagination

    
}

public function 
index() 
{
        
$this->page(1);
}

public function 
page($pagination_id
{
        
// Load the data and view etc




RE: Pagination : Page One Params Issue - Jurden - 12-20-2016

In a basic use you are right but with search params it's kind of.

Thanks.