home | about us | services | portfolio | blog | merchandise | contact us

Paginate Your Site Like Digg

Some people were interested in seeing the code I used to create the pagination for WineLog, which was based on the style of pagination used on sites like Digg and Flickr. I’ve put together a little demo which should help out anyone who is trying to create the same effect on their site.

Screenshot of Digg-Style Pagination in Action

(digg-style pagination demo)

27 Responses to “Paginate Your Site Like Digg”

  1. WineLog Blog | Blog Archive | Pagination Tutorial Now Available at StrangerStudios.com Says:

    […] I hope this helps those who were interested. Please post any questions or comments concerning the code at the Stranger Studios blog post on the demo. Thanks. […]

  2. Evan Says:

    Any simple way to integrate this into Wordpress? I’ve been trying but have run into a lot of error messages.

  3. j4s0n Says:

    Hrmmm, this saves a hell out of my time. I’m planning to write similar like this. Thanks Jason!

    Jason
    (yes, i’m jason too)

  4. Mis Algoritmos » Paginación al estilo Digg y sabros.us Says:

    […] Paginate your site like-digg […]

  5. Andrew Says:

    Nice, this is useful! I’ve ported a version to Perl, which I’ll email to you.

  6. Stranger Studios - Web and Graphic Design Solutions Says:

    […] Earlier in the year, I wrote a tutorial on how to create pagination similar to Digg’s. The article focused on the basic algorithm for displaying the pagination, and there was definitely some opportunity for improvement in its implementation. […]

  7. kev Says:

    Great code!!!
    I was tring to use it in my site, but the ” page nav buttons ” did not show up.
    The listed iterms are fine. any hint?

    BTW seems not work when I check the page source.

    Thanks

  8. Rok Golob Says:

    Hi!

    I have problem vith this script “undefined variable $page”!

    So i add >>>if (isset($_GET[’page’])){$page=$_GET[’page’];}else{$page=0;}0)
    $start = ($page - 1) * $limit;
    ……..

    Regards

  9. Mis Algoritmos » Blog Archive » WP Digg Style Pagination Plugin Says:

    […] La creación de esta plugin de paginación fue basada en la versión modular creada a partir de la original creada por strangerstudios.com. […]

  10. Moazam’s Blog » Blog Archive » ASP: Digg Style Pagination Script Says:

    […] This is ASP based pagination script, similiar to Digg.com pagination. The credit goes to Jason Coleman who written this script in PHP and I simply converted this into ASP.  I have attached screenshot this will help you to see how it looks like. […]

  11. gaskell.org » Digg style custom paging for GridViews in ASP.NET Says:

    […] I’ve been on a bit of a digg kick lately and I like how they handle paging so I decided to create a GridView control that uses custom paging similar to digg’s. The algorithm is based on this post. As far as html output goes, this should be fairly close to the actual output on digg and I’m using digg’s stylesheet in the demo. […]

  12. Brad Says:

    Hey, great script!

    One note for people working with php and not being an expert, I had a small issue come up where it thought the numbers were part of the variable. I had to change the code slightly…

    FROM:
    $pagination .= “1“;
    $pagination .= “2“;

    TO:
    $pagination .= “1“;
    $pagination .= “2“;

  13. jason Says:

    Brad, they look the same to me. Can you explain the change?

    If I had more time I would take a look at the code to see what you were talking about.

  14. Bemular Says:

    Cool stuff!
    Got any Javascript version of this?

  15. icom7 Says:

    Thanks so much to you digg, you are a sweet man. I am trying to use your pagination system on my website.It look so nice, that i am going to change all what i had.
    One more again thanks…You can just see the system here www.icom7.com

  16. jason Says:

    Some people are finding out that you may have to declare the variables passed in through the URL at the top of your code. (my server settings allow me to just access them directly)

    You can add some code like the following to the top:

    $page = $_REQUEST[’page’];

    Rinse and repeat for any other variables you’re passing around.

  17. Jim Says:

    Hi Jason,

    I have not taken this live on my site yet, I am just testing at this
    point…..

    But, I have a question… I have a var, search, in a form that calls this page. The script seems to execute fine, but it is completely empty even when I make a selection that should yield ~150 results.

    Any ideas on what I could be doing wrong?

    Thanks,
    Jim

  18. jason Says:

    Hi, Jim. I’d need to see more of your code to help you out. My guess is there is some error in your SQL query. Make sure that the variable passed by your form really has something in it. Do an “echo $search” at the top of the script. If you aren’t seeing what you should, make sure you are setting the variable (needed on some servers) like so “$search = $_REQUEST[’search’];”.

    Good luck. Feel free to email me for more help.

  19. Jim Says:

    Hello again Jason,

    The vars are being passed properly. I placed a print statement in the script to verify this.

    My question is what var should have the search term in it?

    I tried search to no avail….

  20. Clint Says:

    Could someone please send me a reference of a simple page that impliments this script with just a few pictures on it. I’m really new to this stuff and can not figure it out. I want to use it on my site - imediadotcom.com

  21. Clint Says:

    sorry, i also don’t use sql.

  22. Alex Says:

    The digg style solution here is great. Do you know how to incorporate this into Movable Type 4? I see that you have a Wordpress solution. It’d be great if this could also work in MT4. Thanks.

  23. jason Says:

    I’m not as familiar with Movable Type and its plugins. You can hit up Mis-Algoritmos here:
    http://www.mis-algoritmos.com/2007/05/27/digg-style-pagination-class/

    btw, that’s an interesting class implementation. It’s pretty sweet. I know though that when I was first learning PHP, classes were almost always over kill for me and confused me a bit. If this is you, take a look at some of the older code.

    However, if you are already familiar with classes and/or a PHP expert already who is looking to save time, take a look at that class and use it.

  24. Stacy Says:

    I am having troubles implementing the digg style pagination system into my project. http://www.superwebcamgirls.com can anyone help me with a simple more detailed code.

  25. Mahesh Says:

    The only thing I had to add at the beginning was:

    if(isset($_REQUEST[”page”])) {
    $page = $_REQUEST[”page”];
    } else if(isset($_POST[”page”])) {
    $page = $_POST[”page”];
    } else if(isset($_GET[”page”])) {
    $page = $_GET[”page”];
    }

    after I made the connection to the DB.

    You can see it at work:
    http://www.axewar.com/topaxe.php5

  26. Sander Says:

    Thanks for this excellent piece of script!! Easy to implement and works like a charm!

  27. jason Says:

    Mahesh,

    Looks great on your site. Very nice site also, btw. I should probably add your code to the top of my implementation. It’s only needed if you don’t use the register_globals. However, if you do register globals, this code doesn’t hurt.

    Sander, glad it worked out for you.

Leave a Reply

Subscribe by RSS

View my Wine Log
Kim Wallmeier
View my Wine Log
Jason Coleman
visit our network sites: