Welcome Guest, Not a member yet? Register   Sign In
Multiple Pagination on the same page
#9

[eluser]Unknown[/eluser]
[quote author="simona" date="1324496348"]Found this thread while searching for exactly the same problem as the OP.

I need two paginations on a single page. My URL is of the form:

http://www.example.com/controller/method...t1/offset2

where offset1 is the offset of the first pagination and offset2 is the offset of the second pagination.

I thought I had managed to solve the problem only using the CodeIgniter pagination class by setting config['suffix'] and config['first_url'], but I think I found a bug.

I had controller code of the form:

Code:
public function method($offset1 = 0, $offset2 = 0) {

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

...

//first pagination item
$config['base_url'] = base_url(). 'controller/method/';
$config['first_url'] = base_url(). 'controller/method/0'; //set this because codeigniter pagination class does not append segment to the first page link when offset=0...
$config['suffix'] = '/'. $offset2; //append this to all generated urls
$config['total_rows'] = $table1_count;
$config['per_page'] = $table1_per_page;
$config['uri_segment'] = 3;
$this->pagination->initialize($config);
$table1_pagination = $this->pagination->create_links();

//second pagination item
$config['base_url'] = base_url(). 'controller/method/'. $offset1;
$config['first_url'] = base_url(). 'controller/method/'. $offset1; //need to reset this to same as 'base_url' after setting in first pagination
$config['suffix'] = ''; //need to reset this after setting in first pagination
$config['total_rows'] = $table2_count;
$config['per_page'] = $table2_per_page;
$config['uri_segment'] = 4;
$this->pagination->initialize($config);
$table2_pagination = $this->pagination->create_links();

but the codeigniter pagination class was not appending the suffix to the "First" link or the "Previous" link :-S

So I fixed it, see the attached file (just modified two lines of the codeigniter pagination class create_links() method). The code above works with the attached MyPagination library.

Hope this helps![/quote]

Can I have that Mypagination library? I don't see any attached library


Messages In This Thread
Multiple Pagination on the same page - by El Forum - 01-05-2010, 06:41 PM
Multiple Pagination on the same page - by El Forum - 02-25-2010, 10:45 AM
Multiple Pagination on the same page - by El Forum - 04-01-2010, 08:54 AM
Multiple Pagination on the same page - by El Forum - 04-01-2010, 09:11 AM
Multiple Pagination on the same page - by El Forum - 04-02-2010, 01:31 AM
Multiple Pagination on the same page - by El Forum - 04-18-2012, 10:37 AM
Multiple Pagination on the same page - by El Forum - 07-15-2012, 09:56 PM
Multiple Pagination on the same page - by El Forum - 07-18-2012, 11:20 AM
Multiple Pagination on the same page - by El Forum - 01-25-2014, 07:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB