1
votes

I'm following this tutorial for using the pagination library within codeigniter. I've implemented the tutorial correctly and am even displaying my results in descending order with mysql.

However, codeigniter's pagination library continues to generate links that are in ascending order

public function example1() {
    $config = array();
    $config["base_url"] = base_url() . "welcome/example1";
    $config["total_rows"] = $this->Countries->record_count();
    $config["per_page"] = 5;
    $config["uri_segment"] = 3;

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

    $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
    $data["results"] = $this->Countries->
        fetch_countries($config["per_page"], $page);
    $data["links"] = $this->pagination->create_links();

    $this->load->view("example1", $data);
}

With this code, the links go up by 5 starting at link 1 and stops at total_rows. I want it to count down from total_rows by 5 instead and stop at 0, how do I do this?

Another example:

1 2 3 4 5 > Last »

How would I reverse this list to look something like this:

5 4 3 2 1 > Last »

1

1 Answers

1
votes

You can do it using css

  1. Add class $config['attributes'] = array('class' => 'pagination-link');
  2. Make linkes inline-block a.pagination-link{display: inline-block;}

  3. Then give it direction : rtl