ctcp Posted June 28, 2009 Share Posted June 28, 2009 <?php if ($page != 0) { $back_page = $page - $limit; echo("<a href=\"$PHP_SELF?section=first&query=$query&page=$back_page&limit=$limit\">Back</a> \n");} for ($i=1; $i <= $pages; $i++) { $ppage = $limit*($i - 1); if ($ppage == $page){ echo("<b>$i</b> \n");} else{ echo("<a href=\"$PHP_SELF?section=first&query=$query&page=$ppage&limit=$limit\">$i</a> \n");} } if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { $next_page = $page + $limit; echo(" <a href=\"$PHP_SELF?section=first&query=$query&page=$next_page&limit=$limit\">Next</a>\n");} ?> i got this result page results is 50 per page i got now Back 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 Next how to view only 10 links .. i mean like this Back 1 2 3 4 5 6 7 8 9 10 Next Back 5 6 7 8 9 10 11 12 13 14 15 Next thanks Quote Link to comment https://forums.phpfreaks.com/topic/163980-php-help-d/ Share on other sites More sharing options...
sasa Posted June 28, 2009 Share Posted June 28, 2009 <?php $p = $page/$limit+1; $start = max(1,min($p-5, $pages-10)); $end = min($pages, max($p+5, 11)); for ($i=$start; $i <= $end; $i++) { $ppage = $limit*($i - 1); if ($ppage == $page){ echo("<b>$i</b> \n");} else{ echo("<a href=\"$PHP_SELF?section=first&query=$query&page=$ppage&limit=$limit\">$i</a> \n");} } ?> Quote Link to comment https://forums.phpfreaks.com/topic/163980-php-help-d/#findComment-865089 Share on other sites More sharing options...
ctcp Posted June 28, 2009 Author Share Posted June 28, 2009 thank you mate Quote Link to comment https://forums.phpfreaks.com/topic/163980-php-help-d/#findComment-865099 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.