Welcome Guest, Not a member yet? Register   Sign In
Pagination + URI Routing problem.
#1

[eluser]Unknown[/eluser]
First of all: a short sketch of my layout: I'm creating a (pretty simple) website, where each method ends with a .html extension.

Code:
$config['url_suffix'] = ".html";

So far, so good. Yet, the pagination + URI routing problem occurs with one particular method, which is being routed like this:
Code:
$route['publications'] = "publication/index";

That means that if someone browses to http://domain/publications.html it is being routed to the publication controller and the index method.

What I'm trying to accomplish is the following: the publication controller and the index method should be displaying a paginated list of 10 publications per page. Thanks to a tutorial I found on the Godbit Project, I could compose the following (working) lines of code:

Code:
$this->load->library('pagination');
    $config['base_url'] = base_url().'publications.html?';
    $config['total_rows'] = $this->db->count_all('publications');
    $config['per_page'] = '10';
    $config['page_query_string'] = TRUE;
    $config['full_tag_open'] = '<p>';
    $config['full_tag_close'] = '</p>';

    $this->pagination->initialize($config);
        
    //load the model and get results
    $this->load->model('publications');
    $data['results'] = $this->publications->get_publications($config['per_page'],$this->uri->segment(2));
        
    // load the view
    $this->load->view('view_publication', $data);

Yet, the pagination links don't seem to be working the way I want them. I want links to display (and function) as: http://domain/publications.html?per_page=X where X functions as the offset.

What am I missing?


Messages In This Thread
Pagination + URI Routing problem. - by El Forum - 09-04-2008, 06:18 AM
Pagination + URI Routing problem. - by El Forum - 09-04-2008, 06:38 AM
Pagination + URI Routing problem. - by El Forum - 09-04-2008, 06:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB