Welcome Guest, Not a member yet? Register   Sign In
Pagination : Page One Params Issue
#1

(This post was last modified: 12-20-2016, 02:03 AM by Jurden.)

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 ?
Reply
#2

(This post was last modified: 12-20-2016, 02:53 AM by Diederik.)

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'
Reply
#3

(This post was last modified: 12-20-2016, 03:17 AM by Jurden.)

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 ?
Reply
#4

(This post was last modified: 12-20-2016, 03:30 AM by Diederik.)

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

Reply
#5

(This post was last modified: 12-20-2016, 03:32 AM by Jurden.)

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

Thanks.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB