Featured Posts

Codeigniter Pagination Part 3 OK so we have now covered setting up Codeigniter Pagination and passing some simple data through it. We have also managed to add categories to our posts to make it a little...

Readmore

Codeigniter Pagination Part 2 So leading on from the last screencast we now have some simple data being pushed through the pagination library. Now were going to look at adding categorys to our posts...

Readmore

Codeigniter Pagination Part 1 One of the biggest things I see being asked around the codeigniter forums & IRC channel is pagination. So I have decided to create a set of tutorials from basic setup...

Readmore

Codeigniter Preparation Hopefully if I can keep my promise and will be rolling a set of screencast on this site and part of them will be to do with the Codeigniter Framework. I though it would...

Readmore

Radio Button Replacement With Style I thought I would kick off this blog with a short tutorial on how you can make form radio buttons look and feel allot more interesting. A recent job required the user to...

Readmore

Web Lee Rss

Codeigniter Pagination Part 1

Posted on : 06-06-2009 | In : Codeigniter, Screencasts

15

One of the biggest things I see being asked around the codeigniter forums & IRC channel is pagination. So I have decided to create a set of tutorials from basic setup to move advanced techniques on how to use this library.

In this screencast I will discuss how to get basic codeigniter pagination working with some simple data.


Screencast Length: 16:30

You can download sample files here .

Design supplid by Free CSS Templates

Comments (15)

Thank you. This helped me understand pagination. The Code Igniter documentation didn’t have this that I could find.

Thanks! I’m new the codeigniter and your casts help immensely

Quick question. How do you get that Posts link to work and direct to the Posts page?

I’ve created the controller, model, and view like you did. Then I went into inc/header.php to add the link to Posts. At first I just entered the link as – a href…. /posts.php but that didn’t work.

Then I read some reading and discovered the anchor function of the url helper which I’ve already autoloaded. So I tried

echo anchor(’posts’, ‘Posts’) but that isn’t working either.

I also tried

echo anchor(’posts/index’, ‘Posts’)

Help?

thanks

One more thing, not sure if it makes a difference but I’m using CI version 1.7.2

thanks for the excellent screencasts!!

This is the second of your series that I have studied and given the date of the screencast it looks like I am about a month behind. I like what I am learning.
My problem right now is seeing how you linked from the welcome page to your post controller.
I was able to modify the welcome page as you have done, with the assets directory and the header and footer includes. I don’t see how you linked the new POST menu item from the welcome page to get to the post controller.
Looking to get to the rest of the tutorials this week.

Nice cast helped a lot to understand gr8

Sorry for the late response. Not quite sure what your issue is? If you still got a problem just send me an email with some example code and ill point you in the right direction.

Hi Lee,

First thanks for the great tutorial… it has really helped a lot.

To help me get my head around ci pagination more, I placed your sample ‘posts’ code into the correct directories on a local machine and it all works great.

My issue is that I need to use pagination in a project where the controller is located in a subdirectory (controllers/administration/). When I run the sample posts controller from this directory all of the data appears fine and I can page through it.

The big problem is that the first page links no longer work. When I move the controller out of the subdirectory (controllers/administration/) back to Controllers…. everything works perfectly.

I’m running ci 1.7.2 and would really appreciate your help as this is really doing my head in.

Cheers, Andrew.

Hello Lee,

I know this is very late and you probably might not check this page regularly but I will give it a shot.

First of all, this is a great detailed tutorial, I had seen many pagination tutorials but none of them as clear as this one.

The issue that I can facing is connecting the pagination links. My first page seems to work perfectly but the other links don’t seem to work. I know its probably some small silly thing but i had spent hours figuring out what the problem might be but I have failed.

Would you like me to sent the source code to see what the issue is?

Ops Thanks, found the error!

Enjoying your other screen casts too!

Hi Lee, thanks for taking the time to post this nice tutorial.

It explains much more than the CI documentation, and now I was actually able to put my pagination to work.

Nice work. Keep it up.

Cheers,

Thanks for this Great Tutorial! I really thankful to you.

awesome, just what I need to know

Excellent work, thank you very much.

I’m just wondering about this. When you click on pagination link ‘3′, the url’s third segment actually becomes ‘4′, pagination link ‘4′ leads to segment ‘6′, ‘5′ leads to ‘8′ etc. Although the correct data is displayed, I’d like to know is it possible to set url’s third segment to correctly follow the pagination links’ numbers?

Thanks a lot :)

Write a comment