42 Responses to “Paginate Your Site Like Digg”
Leave a Reply
Categories
- Artwork (1)
- Browsers (2)
- Business (1)
- Client Work (5)
- CSS (4)
- Design (7)
- Development (2)
- Entrepreneurship (5)
- Humor (1)
- Interactive 8ball (3)
- Mobile Web (1)
- New Projects (5)
- News (5)
- PHP (5)
- State Education Policy (1)
- Tutorial (1)
- Uncategorized (1)
- Web (13)
- WineLog (3)
Archives




July 7th, 2006 at 4:20 pm
[...] 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. [...]
August 23rd, 2006 at 7:36 am
Any simple way to integrate this into Wordpress? I’ve been trying but have run into a lot of error messages.
October 11th, 2006 at 12:24 am
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)
November 28th, 2006 at 6:28 pm
[...] Paginate your site like-digg [...]
December 27th, 2006 at 3:19 am
Nice, this is useful! I’ve ported a version to Perl, which I’ll email to you.
December 29th, 2006 at 1:13 pm
[...] 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. [...]
January 16th, 2007 at 2:42 pm
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
March 8th, 2007 at 6:29 pm
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
March 12th, 2007 at 8:14 pm
[...] 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. [...]
March 31st, 2007 at 12:08 am
[...] 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. [...]
April 12th, 2007 at 9:09 pm
[...] 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. [...]
May 14th, 2007 at 3:40 pm
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“;
May 16th, 2007 at 12:41 pm
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.
May 17th, 2007 at 4:28 am
Cool stuff!
Got any Javascript version of this?
June 18th, 2007 at 2:18 pm
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 http://www.icom7.com
July 3rd, 2007 at 11:45 am
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.
August 17th, 2007 at 10:12 am
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
August 17th, 2007 at 10:46 am
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.
August 17th, 2007 at 11:41 am
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….
August 25th, 2007 at 8:08 pm
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
August 25th, 2007 at 8:11 pm
sorry, i also don’t use sql.
September 2nd, 2007 at 12:30 am
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.
September 2nd, 2007 at 10:32 am
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.
December 19th, 2007 at 8:38 am
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.
March 3rd, 2008 at 4:34 am
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
March 19th, 2008 at 9:26 pm
Thanks for this excellent piece of script!! Easy to implement and works like a charm!
March 19th, 2008 at 10:33 pm
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.
June 28th, 2008 at 12:12 am
how to integrate like this :
Displaying 1 - 16 of 365 queries [Total 22 Pages]
thanks,
Kanchan
July 5th, 2008 at 11:14 pm
How to show in this pagination??
Showing from 1 to 20 from 200 queries.
September 11th, 2008 at 12:08 am
I really want to use this script but not really understanding how you implement the code into the site. I’m a php newbie- please help!
October 2nd, 2008 at 12:42 am
In the modularized version of the function, diggstyle_function.txt, there is a typo on line 55. ($adjacents * 3) should be ($adjacents * 2).
October 7th, 2008 at 6:49 am
Is anyone still offering help with this? I would really like to use this with my Zenphoto gallery. Please help!
October 7th, 2008 at 12:08 pm
Kanchan, if you are still interested email me (use contact form). I’ve done this on some of my projects and can try to get an example on this site.
Jason
October 24th, 2008 at 7:14 pm
Thank you very much. tried it and loved it. working perfect
October 28th, 2008 at 5:40 am
Ubercool script, I made it work with jQuery at http://www.dealspost.com (scroll to the bottom). Only one glitch I have found: if you have a lot of records in the database (hundreds) and you set adjacents = 3 then on page 9 will dissappear link Next and pagination will not generate links to pages 10+ except for the last two pages. But if you change to adjacents=2 it works like a charm.
Thanks a lot for your work.
Joe
October 29th, 2008 at 1:28 pm
Script works perfect if I want to select everything from the table. But When I chose certain categories from the table, first page comes ok. but other pages are empty.
I used this query
$query = “SELECT * FROM $tablename WHERE country=’$country’ AND typeoffood=’$typeoffood’”;
Another thing is, the number of pages that is showing is for whole table because of this code I think:
$queryCount = ‘SELECT count(*) FROM ‘.$tablename;
I am very new to php. Can you help?
December 13th, 2008 at 10:19 am
Am trying to use the pagination code but its not giving me any results. What am i missing. Nothing completly shows up. Please help me
January 28th, 2009 at 1:16 pm
firstly,this is good coding..
but i have some problem.the page is always shows this error :
Use of undefined constant num - assumed ‘num’
this is my coding:
$query = “SELECT COUNT(*) AS num FROM $tbl_name”;
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
did i do anything wrong??please help me..actually,i’m not very good in php..please help me..i need help coz this part is important to me..i need this ASAP..
Thanks..
February 7th, 2009 at 9:32 pm
excuse the trite question, but where I take the code in my db?
What exactly should I enter in this part of the code? “Place code to connect to your DB here.”
April 3rd, 2009 at 10:07 am
First, folks with DB or other app issues, I’m sorry I can’t help you more. If you have the budget, you can contact us (use link in top menu), and we can take a look at your code at our consulting prices.
Secondly, someone emailed me with some minor updates to the code and CSS that offer better scaling/resize support for IE browsers. The code on the demo site has been updated.
Thanks!
April 15th, 2009 at 7:40 am
thanks to this code .
this is good coding.. I m implementing this code to my all sites that i had done..
Thanks a lot….
April 27th, 2009 at 12:08 am
Wonderful pagination script , I used it already, thanks a lot.