Welcome Guest, Not a member yet? Register   Sign In
Advanced pagination
#1

[eluser]Unknown[/eluser]
Hi,

I have the following URL for pagination:

http://127.0.0.1:10088/MyApp/index.php/a...10/id/DESC

1.) 10 = offset
2.) 10 = limit
3.) id = order_by
4.) DESC = direction

So when my controller ignites the model's query; it'll be like this:

Code:
SELECT * FROM `myBrands` ORDER BY `id` DESC LIMIT 10, 10

My pagination limits me now with these multiple segments (method parameters). These are my settings:

Code:
$tconfig['base_url'] = base_url().'index.php/admin/brands/';
$tconfig['uri_segment'] = 3;
$tconfig['total_rows'] = '99999';
$tconfig['per_page'] = $result_limit;

$this->pagination->initialize($tconfig);

I had a problem before with shifting the uri_segment (the pagination wasn't tracked right..) so I stayed with the first segement in my controller.

This is how I link with sorting and stuff:
Code:
$tconfig['base_url'] = base_url().'index.php/admin/brands/'.$result_offset.'/'.$result_limit.'/'.$order_by.'/'.$direction.'/';

The offset variable is the one that causes pagination to work. Can I just do this?:
Code:
$tconfig['base_url'] = base_url().'index.php/admin/brands/'.$PAGINATION_MAGIC_KEY??.'/'.$result_limit.'/'.$order_by.'/'.$direction.'/';


Messages In This Thread
Advanced pagination - by El Forum - 01-10-2010, 05:23 AM
Advanced pagination - by El Forum - 01-10-2010, 06:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB