Pagination is returning blank page - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Pagination is returning blank page (/showthread.php?tid=24314) |
Pagination is returning blank page - El Forum - 11-05-2009 [eluser]NateL[/eluser] Following Day 7 of Jeff Way's CI From Scratch Tutorials, Pagination. I've followed everything almost down exactly, and my page is still showing up blank. What am I doing wrong? Controller: portfolio.php Code: class Portfolio extends Controller View: portfolio_view.php Code: <?php Pretty straight forward, right? Pagination is returning blank page - El Forum - 11-05-2009 [eluser]NateL[/eluser] OK. tinkin around some more... It works when I hard code the total_rows: Code: $config['total_rows'] = 30; However, this doesn't work. Code: $config['total_rows'] = $this->db->get('portfolio')->num_rows(); mk. sooo how can I dynamically retrieve the number of rows that exist? and why is num_rows() not working for me - even though it clearly works in the video ? Pagination is returning blank page - El Forum - 11-05-2009 [eluser]NateL[/eluser] Fast approaching deadline...really need help with this. Now I've got these settings: Code: $config['per_page'] = 5; and my page is showing 7 results....I don't even have 7 results IN the database edit: OK - looks like those 7 results are being generated by this array... Code: array(1) { what is going on here? Pagination is returning blank page - El Forum - 11-05-2009 [eluser]NateL[/eluser] Well, I finally figured it out after a few hours of trial and error. It aint pretty, but damn it...it works. Code: function index() I will work on cleaning all that up and getting it into Models...but at least I'm getting the results I was after Pagination is returning blank page - El Forum - 11-06-2009 [eluser]Zeeshan Rasool[/eluser] I think this type of learning is much better ;-) it helps you a lot Pagination is returning blank page - El Forum - 11-06-2009 [eluser]Jamie Rumbelow[/eluser] Just a quickie, you can optimise this code and speed it up by quite a big amount by running a SELECT COUNT(*) query rather then pulling the entire table down then counting the rows. It's really easy to do with CodeIgniter's ActiveRecord: Code: $config['total_rows'] = $this->db->count_all('portfolio'); Pagination is returning blank page - El Forum - 11-06-2009 [eluser]NateL[/eluser] [quote author="Jamie Rumbelow" date="1257549340"]Just a quickie, you can optimise this code and speed it up by quite a big amount by running a SELECT COUNT(*) query rather then pulling the entire table down then counting the rows. It's really easy to do with CodeIgniter's ActiveRecord: Code: $config['total_rows'] = $this->db->count_all('portfolio'); Thanks Jamie. Do me a favor and crack the whip on Elliot - Been waiting around on the 4th Code Igniter video on BinaryCake :-P Pagination is returning blank page - El Forum - 11-06-2009 [eluser]Jamie Rumbelow[/eluser] Hah, it'll be out very soon, we've both been hectic! *special* |