Welcome Guest, Not a member yet? Register   Sign In
Question about pagination on CI3
#3

(05-17-2015, 03:02 AM)InsiteFX Wrote: Segments = Controller / Method / Method / etc;




PHP Code:
$config['uri_segment'] = 5

That will put me in a hard spot due to different variables I must pass on different controllers.

I manage to find a walk around using pagination's $config['suffix'] like this

Code:
$additional_variables = '/category/item_id';

$this->load->library('pagination');

$config['base_url'] = base_url().'test/page/';
$config["uri_segment"] = '3';
$config['total_rows'] = 200;
$config['per_page'] = 10;

$config['suffix'] = $additional_variables.$this->config->item('url_suffix');

$config['use_page_numbers'] = TRUE;
$this->pagination->initialize($config);

so now I can switch from

Code:
http://example.com/test/page/1

to

Code:
http://example.com/test/page/1/category/item_id

everything seems to be working right now but not with page number 1. CI pagination ignore everything after the second segment on page 1 like this

Code:
1 = http://example.com/test/page/1
2 = http://example.com/test/page/2/category/item_id
3 = http://example.com/test/page/3/category/item_id
4 = http://example.com/test/page/4/category/item_id

that means the user can't go back to see items on the requested category on page 1
Reply


Messages In This Thread
Question about pagination on CI3 - by Mel9pr - 05-16-2015, 05:08 PM
RE: Question about pagination on CI3 - by Mel9pr - 05-17-2015, 08:08 AM
RE: Question about pagination on CI3 - by Mel9pr - 05-17-2015, 08:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB