Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Pagination and URI Routing Problem

[eluser]Rob Rightmyer[/eluser]
We are having problems using pagination in conjunction with URI routing.

Things are working as expected except the "current" page is not advancing when each pagination link is clicked.

$route['gallery2/:num'] = "gallery2/index";

Gallery2.php (controller):

class Gallery2 extends Controller {

    function Gallery2()

        //Load the HTML, URL and Form helpers

    function index()
        //Load the Database class
        //Load the pagination libarary, setup pagination variables, initialize pagination
        $config['base_url'] = base_url().'gallery2';
        $config['total_rows'] = $this->db->count_all('gallery');
        $config['per_page'] = '8';
        $config['num_links'] = '100';

        //Sort the database results
        $this->db->order_by('id', 'desc');

        //Query the database
        $data['query'] = $this->db->get('gallery', $config['per_page'],$this->uri->segment(2));

        //Load the Photo Gallery view        
        $this->load->view('gallery2', $data);

If I've ommitted any information that would be helpful in solving this please let me know.

[eluser]Rob Rightmyer[/eluser]
After a little more digging, I found my answer here:

Needed to add this config line to my pagination:
$config['uri_segment'] = '2';

Everything works great now.

Theme © iAndrew 2016 - Forum software by © MyBB