Welcome Guest, Not a member yet? Register   Sign In
Pagination issue
#1

(This post was last modified: 07-12-2018, 02:25 PM by barrypoore.)

Hi have finally got pagination working (kind of) but cannot resolve two issues:
  • First link isn't actually a link its just a strong tag so you can never get back to the first page, even if you proceed clicking through the links it doesn't become active:

    <ul class="pagination">
    <strong>1</strong>
    <a href="http://codeigniter.local/jobs/12" data-ci-pagination-page="2">2</a>


  • The last link '>' always links to the second link as above, http://codeigniter.local/jobs/12
My controller class is as follows:
        $config["base_url"] = base_url() . "jobs";
        $config["total_rows"] = $this->jobs_model->record_count(); // returns the amount of rows
        $config["per_page"] = 12;
        $config["uri_segment"] = 2;
        $choice = $config["total_rows"] / $config["per_page"];
        $config["num_links"] = round($choice);

Maybe the tutorial I followed has led me up the garden path a bit, I did try and find one in the codeigniter documentation but could only find how to generate the pagination links but it didn't include how to integrate it into my queries so I ended up with pagination links but 500 records on one page.

If anyone could assist or point me to a decent tutorial it would be much appreciated.

I don't really know what else to post, the other functions are straight forward queries, I'm guessing the issue is in the config above. If I remove the last two then 'Last >' is appended to the end and has the correct link url.

I followed this tutorial:
https://www.sitepoint.com/pagination-with-codeigniter/
Reply


Messages In This Thread
Pagination issue - by barrypoore - 07-12-2018, 02:11 PM
RE: Pagination issue - by php_rocs - 07-12-2018, 03:17 PM
RE: Pagination issue - by ciadmin - 07-12-2018, 04:47 PM
RE: Pagination issue - by barrypoore - 07-13-2018, 01:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB