brent123456 Posted November 30, 2007 Share Posted November 30, 2007 if($num_pages > 1) { // determine what page the script is on. $current_page =($start/$display) + 1; // if not on the first page make a previous page if ($current_page != 1) { echo '<a href="index.php?do=requestpage&s=' . ($start - $display) . '&np=' . $num_pages . '"> Prev </a> '; } // make all the numbered pages for ($i = 1; $i <= $num_pages; $i++) { if($i != $current_page) { echo '<a href="index.php?do=requestpage&s=' . (($display * ($i - 1))) . '&np=' . $num_pages . '">' . $i . '</a>'; } else { echo $i . ''; } } // if it's not the last page , make a next button. if ($current_page != $num_pages) { echo '<a href="index.php?do=requestpage&s=' . ($start + $display) . '&np=' . $num_pages . '"> Next </a> '; } } I am having trouble trying to figure out how to break this up into only a few pages at a time like <prev 3 4 5 next> instead of 1234567891011121314 next>. Could anyone offer me a hand with this it would be a big help. Thanks. Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 30, 2007 Share Posted November 30, 2007 i have answered this question i guess lol http://www.phpfreaks.com/forums/index.php/topic,169359.msg747446.html#msg747446 Quote Link to comment Share on other sites More sharing options...
brent123456 Posted November 30, 2007 Author Share Posted November 30, 2007 Thank you, I Have looked this over but I am still having trouble figuring out he logic to get the pages. $x only prints out 789 everytime but the pages only go till 7 so far. I am not really sure were to implement the number of pages in my paging code. $totalpage = 100; $pagelimit=3;//3row $p=(int)($num_pages/$pagelimit)+1; echo $p; $pagedisplay =$p*$pagelimit; $num_pages = $pagedisplay - 3+1 ; for ($x = $num_pages;$x<=$pagedisplay;$x++){ echo $x; } if($num_pages > 1) { // determine what page the script is on. $current_page =($start/$display) + 1; // if not on the first page make a previous page if ($current_page != 1) { echo '<a href="index.php?do=requestpage&s=' . ($start - $display) . '&np=' . $num_pages . '"> Prev </a> '; } // make all the numbered pages ffor ($x = $num_pages;$x<=$pagedisplay;$x++){ if($i != $current_page) { echo '<a href="index.php?do=requestpage&s=' . (($display * ($i - 1))) . '&np=' . ($display*$x) . '"> ' . $x . ' </a>'; } else { echo $x . ''; } } // if it's not the last page , make a next button. if ($current_page != $num_pages) { echo '<a href="index.php?do=requestpage&s=' . ($start + $display) . '&np=' . $num_pages . '"> Next </a> '; } } Quote Link to comment Share on other sites More sharing options...
brent123456 Posted December 2, 2007 Author Share Posted December 2, 2007 Could anyone offer me some advice on this one? Quote Link to comment 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.