stacheldraht27
stacheldraht27

Reputation: 392

codeigniter 3.0 pagination with get parameter

I have use codeigniter pagination, i add GET parameter to url. the problem is when i change to next page all of my GET parameter are disappear

example url+ parameters:

http://localhost/test/index.php/search/product/?sort_by=price&order=ASC

when i click page 2 which is next page, the url become like this:

http://localhost/test/index.php/search/product/5

I want the url to become like this:

http://localhost/portofolio2/index.php/search/product/5?sort_by=price&order=ASC

===========================================================================

UPDATE<<

I add $config['suffix'] to the $config array, now when I go to next page the GET parameter didn't dissapear. but there is new problem, when I navigate back to the first page my GET parameter dissapear again.

this my $config for pagination looks like

'base_url' => base_url() . 'index.php/search/product/',
        'suffix' => '?sort_by=' . $sort_by . '&order=' . $order,
        'use_global_url_suffix' => TRUE,
        'reuse_query_string' => FALSE,
        'total_rows' => $this->products_model->total_row(),
        'per_page' => 5,
        'num_links' => 20,
        'full_tag_open' => '<ul class="pagination">',
        'full_tag_close' => '</ul>',
        'first_link' => FALSE,
        'last_link' => FALSE,
        'first_tag_open' => '<li>',
        'first_tag_close' => '</li>',
        'prev_link' => '&laquo',
        'prev_tag_open' => '<li class="prev">',
        'prev_tag_close' => '</li>',
        'next_link' => '&raquo',
        'next_tag_open' => '<li>',
        'next_tag_close' => '</li>',
        'last_tag_open' => '<li>',
        'last_tag_close' => '</li>',
        'cur_tag_open' => '<li class="active"><a href="#">',
        'cur_tag_close' => '</a></li>',
        'num_tag_open' => '<li>',
        'num_tag_close' => '</li>',

Thanks

Upvotes: 0

Views: 3101

Answers (1)

lucek
lucek

Reputation: 111

http://www.codeigniter.com/userguide3/libraries/pagination.html#customizing-the-pagination

AND $config[‘reuse_query_string’] = FALSE;

//UPDATE (problem with first page):

After $config:

$config['first_url'] = $config['base_url'] . $config['suffix'];

Upvotes: 4

Related Questions