Digg.com style pagination function
I introduce nice Digg.com style pagination function. This pagination function is very flexible and easy to implement in all kind of scripts. All you have to do is to set current page parameter, total pages parameter and pagination format. I will give you an example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | <? //include paginate funtion include('paginate.php'); //get total pages number $total = $db['result']['total_pages']; //get curent page $page = $_GET['p']; //formate pagination layout $format_pg = array ( 'start_tag' => '<ul>', 'close_tag' => '</ul>', 'a_open' => '<li>', 'a_close' => '</li>', 'a_curent' => ' style="color:red"', 'url_q' => '?p=%d', 'lang_next' => 'NEXT', 'lang_previous' => 'PREVIOUS', 'a_space' => '...', ); //finaly print pagination echo paginate($page, $total, $format_pg); ?> |
Paginate function is free. To download paginate function hit following link:



























just small update:
line:
if ($total_pages > 0)
change to:
if ($total_pages > 1)
I think it would be really cool if you could add some CSS kind of like digg’s pagination, this would top it all off nicely - if you need any assistance with this then please e-mail me.
I was looking for an adaptable page numbering function, thanks for providing me with this code!
hi, Del you can customize your pagination in format_pg array, just add css classes to pagination start tag and a_open tag.
Thank you, i didn’t have any problems styling the pagination. I was suggesting that you alter the current code and release it with some nice styles.
Thanks again.
hi i know this is an old post but i do have couple of questions.
just want to know this bit of codes $total = $db[\’result\’][\’total_pages\’];
what do i replace result and total_pages?
any help would be great cheers