Hi, I need an algorithm for paging. If I have 100 pages of results, I only want to show << Prev 1 2 3 4 5 6 7 8 9 10 Next >>
Where I limit the number to 10 results of pages, but I cannot figure it out for the life of me. for ($i = $page; $i <= ($page+10); $i++) { if ($i != $page) { echo " <a href=\"$PHP_SELF?catid=$catid&page=$i\">$i</a> "; } else { echo " $i "; } } echo " <a href=\"$PHP_SELF?catid=$catid&page=$i\">>></a> "; echo " <a href=\"$PHP_SELF?catid=$catid&page=$num_pages\">End</a> "; } But what I need to do is not show pages that aren't there, and I'm hardwiring it to show 10 whether they exist or not. I've got to believe that there's a really slick way of doing this. I've searched the usual places (weberdev.com, devshed.com, zend.com) but there's no really good keywords, and when you search on 'paging" you get too many results to be useful Thanks in advance, Lara --------------------- Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]