In these last two weeks, I’ve received bunches of requests for a CodeIgniter pagination screencast; so that’s what we’ll be reviewing today! As a bonus, we’ll also take a look at the super convenient HTML Table class.
Catch Up
- Day 1: Getting Started With the Framework
- Day 2: Database Selecting Methods
- Day 3: Sending Emails
- Day 4: Newsletter Signup
- Day 5: CRUD
- Day 6: Login
Day 7: Pagination
Other Viewing Options
Thank you, Screencast.com!
- Follow us on Twitter, or subscribe to the Nettuts+ RSS Feed for more daily web development tuts and articles.









Great tutorial jeff, how would one use this framework to show the records as blog posts rather than in a table?
Jeff:
Please come back with more CI stuff. I am late to the tutorial and this was lovely. Please keep your promise in the first tutorial where you would develop a full web site.
Thanks for doing this series.
One more thought.
The one way I could get the pagination program to work is to change the line on my machine from:
$config['base_url'] = ‘http://localhost/ci_day7/index.php/site/index;
to
$config['base_url'] = base_url().’?site/index/’;
which is actually thhe same except for the question mark. I have been in the user guide for over an hour and I can’t figure this out. Where can I read about the question mark and that syntax.
Another is modifying the .htaccess file and adding the “site/index/” to it.
RewriteRule ^(.*)$ /ci/index.php?/site/index/$1 [L]
This fixed the problem for me when using mod_rewrite to remove the index.php.
My base url: http://localhost/ci/
Sadly that would also break everything else. So almost there.
Config:
$config['base_url'] = base_url().’site/index/’;
With a rewrite rule:
RewriteRule ^(.*)$ /ci/index.php?/$1 [L]
Generates links like this:
http://localhost/ci/app/index/1
Fixed!
PS Great Tutorial. Hope to see more on CI soon. I love it.
Hi Jeff:
I find your screencasts really usefull, I mean… FANTASTIC.
I’d suggest ci+ajax+jquery for next one.
Come on J.! lot of people will be more than happy to watch more from you.
Walter
HI jeff,
The link for this screencast is not working. Same is happening for day-6 too.
Can you restore it?
Thanks
Walter
Two months since last CI tutorial, guess it’s officially DOA.
I’ve enjoyed these and they have helped me take my coding to the next level. Thanks Jeff.
Thanks for the excellent tutorials!
To my best regret links for last two – 6 and 7 are broken.
Anyway, after long search in www, I found out Day 7 –
http://blip.tv/file/2670407
Unfortunately, I couldn’t find Day 6.
Jeff, please – Christmas is coming, make us a present and restore Day 6 and 7
Best Regards
Come on man – don’t stop them now – you said you’d do 10 days…
If these have stop you could at least say so?
Thanks have really enjoyed them.!
Thank you Jeff,
I just created a site for a client using codeigniter which i learned from your tutorials.
You’ve helped me a lot.
Thanks again.
Thanks Jeff for these, hope you will continue with it !
For those looking for Day 6 and Day 7 you can download them from Rapidshare.
http://rapidshare.com/files/318456608/nettuts_codeigniter_day6.zip
http://rapidshare.com/files/318603335/nettuts_codeigniter_day7.zip
For those looking for Day 6 and Day 7 you can download them from Rapidshare.
http://rapidshare.com/files/318456608/nettuts_codeigniter_day6.zip
http://rapidshare.com/files/318603335/nettuts_codeigniter_day7.zip
Jeff thanks for these great tutorials, hope you will continue with them !
Some more download links:
http://www.wikiupload.com/download_page.php?id=201320 (download)
http://tinypic.com/player.php?v=259wv7l&s=6 (watch)
rapidshare links are just from premium users….
The next chapter of this series would be a great Christmas gift… ^_^
I have not got a codeigniter pagination that shows the uri segment as 1 for the first page,2 for second page and so on…. Instead using Codeignitr pagination the url is offset by 1. ie: its showing 1 for the secnd page, 2 for the 3rd page and so on….
Can u please give me a code so that i can do this.
I’ve enjoyed your tutes, specially about Code Igniter, they’re really great.
I haven’t had the chance to go around all of them, but once you encourage comments and tute proposals for this series. I have one :=D
Could you do one, about the benefits about the URL system/class in place with Code Igniter, but most of all how to use them wisely.
It would be really great.
Just wanted to add in how awesome these tutorials are.. You totally make CI and MVC a joy to work with!
thanks!
is there a day 8 , 9 and 10 coming???
Wonderfull tutorials! I agree more on this subject would be great.
Thx Very Good Tutorial! Keep going! =P
Please continu this great series!
Please more CI!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Yeah more Codeigniter!
Even just a quick tip on how to get rid of the index.php, havent gotten a hacj to work yet!
Is it possible to see a chapter 8 in near future? Your tutorials are very helpful for learning CodeIgniter.
Maybe you could do some more database tutorials for CodeIgniter from Scratch Day 8 I would like to see how to store categories in database, show then on page with pagination. Then results under those categories with pagination support also. Thanks.
i am in need of another Codeigniter day
Hay Jeffrey I was wondering if you would consider doing a tutorial on dynamically loading pages, like in a blog where you have one source file that gets a page id and loads the data. I know how to do it in php but i do not know how to approach it using MVC.
–thanks!
@Al
Hey, you should be able to do something similiar using the CodeIgniters parse functions, take a look here: http://codeigniter.com/user_guide/libraries/parser.html
I hope it will help you
I swear you miss one F’ing character and you can piss away hours of time……
I am learning though. The hard way………
ya i know exactly what you mean! it can get pretty tedious sometimes.
I moved to new host and messed up CI layout format. Didnt change anything, can someone email me what happen is it server permissions? See at http://www.teacher-x.com
THANKS
Really nice tuts and learned a lot from them, but I was thinking if there isent another way to do this, because this way I don’t really know how to tamper with the actual results, set I only want to show 100 chars of the content part? I know there is a way to change the layout of the table to divs, but it would be really nice with a chance to tamper the actual data.
Awesome tut as always Jeffrey!
Realley helped me
but if we won’t display the id , how can we do this ?
Greetings from Serbia! Thank you for your lessons that contribute to the development of better web applications!
I’m having an issue with the pagination and the routes.php file. Can you retain the clean URLs? I have to put in the full url in the base_url config parameter, so the subsequent pages are much longer than the others.
And I had to use rsegment rather than the simple segment. It works now, but with the ugly URLs.
Could there be another AJAX pagination solution where the URL itself doesn’t change?
Direct Link to the video:
Day 7: Pagination
http://a42.video2.blip.tv/5590002203982/NETTUTS-CodeIgniterFromScratchDay7758.flv
one more link
http://a-mirror.video2.blip.tv/NETTUTS-CodeIgniterFromScratchDay7758.flv