Pagination issue |
Hi have finally got pagination working (kind of) but cannot resolve two issues:
$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/
@barrypoore,
Did you try to see if you could use the CI pagination feature first ( https://codeigniter.com/user_guide/libra...pagination )?
The sitepoint tutorial is for CodeIgniter 2. There have probably been some changes for version 3
php_rocs advice is reasonable
(07-12-2018, 04:47 PM)ciadmin Wrote: The sitepoint tutorial is for CodeIgniter 2. There have probably been some changes for version 3 Yes I realise now that tutorial is dated, I found another one and have it all working now, it has one more method then I was hoping for but it seems to work, I'll check out that php_rocs, cheers. Used this one now: https://code.tutsplus.com/tutorials/pagi...-cms-29030 |
Welcome Guest, Not a member yet? Register Sign In |