|
| 1 | +<style> |
| 2 | +#tnt_pagination { |
| 3 | + display:block; |
| 4 | + text-align:left; |
| 5 | + height:22px; |
| 6 | + line-height:21px; |
| 7 | + clear:both; |
| 8 | + padding-top:3px; |
| 9 | + font-family:Arial, Helvetica, sans-serif; |
| 10 | + font-size:12px; |
| 11 | + font-weight:normal; |
| 12 | +} |
| 13 | + |
| 14 | +#tnt_pagination a:link, #tnt_pagination a:visited{ |
| 15 | + padding:7px; |
| 16 | + padding-top:2px; |
| 17 | + padding-bottom:2px; |
| 18 | + border:1px solid #EBEBEB; |
| 19 | + margin-left:10px; |
| 20 | + text-decoration:none; |
| 21 | + background-color:#F5F5F5; |
| 22 | + color:#0072bc; |
| 23 | + width:22px; |
| 24 | + font-weight:normal; |
| 25 | +} |
| 26 | + |
| 27 | +#tnt_pagination a:hover { |
| 28 | + background-color:#DDEEFF; |
| 29 | + border:1px solid #BBDDFF; |
| 30 | + color:#0072BC; |
| 31 | +} |
| 32 | + |
| 33 | +#tnt_pagination .active_tnt_link { |
| 34 | + padding:7px; |
| 35 | + padding-top:2px; |
| 36 | + padding-bottom:2px; |
| 37 | + border:1px solid #BBDDFF; |
| 38 | + margin-left:10px; |
| 39 | + text-decoration:none; |
| 40 | + background-color:#DDEEFF; |
| 41 | + color:#0072BC; |
| 42 | + cursor:default; |
| 43 | +} |
| 44 | + |
| 45 | +#tnt_pagination .disabled_tnt_pagination { |
| 46 | + padding:7px; |
| 47 | + padding-top:2px; |
| 48 | + padding-bottom:2px; |
| 49 | + border:1px solid #EBEBEB; |
| 50 | + margin-left:10px; |
| 51 | + text-decoration:none; |
| 52 | + background-color:#F5F5F5; |
| 53 | + color:#D7D7D7; |
| 54 | + cursor:default; |
| 55 | +} |
| 56 | +#embed { |
| 57 | +padding-top:7px; |
| 58 | +} |
| 59 | +</style> |
| 60 | + |
| 61 | +Note: This CSS design is freely available here:<a href="http://www.thewebhelp.com/css/pagination-style-template/">Pagination Style Template</a><br /> |
| 62 | +And does not belong to me. All credit for the design goes to this author.<br /> |
| 63 | +<br /> |
| 64 | +<?php |
| 65 | +include('config.php'); |
| 66 | + |
| 67 | +$max = 6; |
| 68 | +$select = "SELECT * FROM test"; |
| 69 | +$query1 = mysql_query($select) or die( mysql_error() ); |
| 70 | +$total = mysql_num_rows($query1); |
| 71 | + |
| 72 | +$nav = new Pagination($max, $total); |
| 73 | + |
| 74 | +$query2 = mysql_query($select." LIMIT ".$nav->start().",".$max) or die(mysql_error()); |
| 75 | +while($item = mysql_fetch_object($query2)) |
| 76 | +{ |
| 77 | + echo $item->id . ' - <b>' . $item->name . '</b><br />'; |
| 78 | +} |
| 79 | + |
| 80 | +$link = 'customdesign.php?p='; |
| 81 | + |
| 82 | +echo '<div id="tnt_pagination">'; |
| 83 | +echo $nav->first('<a href="'.$link.'{nr}">First</a>') . $nav->previous('<a href="'.$link.'{nr}">« prev</a>'); |
| 84 | + |
| 85 | +echo $nav->numbers('<a href="'.$link.'{nr}">{nr}</a>', '<span class="active_tnt_link">{nr}</span>'); |
| 86 | + |
| 87 | +echo $nav->next('<a href="'.$link.'{nr}">Next »</a>') . $nav->last('<a href="'.$link.'{nr}">Last</a>') . |
| 88 | +$nav->info('<br /><div id="embed"><span class="active_tnt_link">Result {start} to {end} of {total}</span>') . $nav->info('<span class="active_tnt_link">Page {page} of {pages}</span></div>'); |
| 89 | + |
| 90 | +echo '</div>'; |
0 commit comments