View Single Post
Old 04-09-2009, 02:48 AM   #16 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by WebSavvy View Post
I suppose it'd be easy to grab the current page from $newp based on location (e.g., page.php?p=xx)

then add + or - to the display before and after current number.

After the weekend I might have some free time to work on this and see what I'm able to come up with. However, if you come up with anything prior to that please do update the thread. I'd be interested in seeing what you did with it too.
Yes you're right, that's basically what I just did. It's kind of dirty, so hopefully I can have time later and clean it up via OO or even just make a nice function out of it. Here's what I got working and it works great!!




Code:
<?
if(!$newp2) $newp2 = 5;
if(!$_GET[p]) $p = 1;

?>

  pages:
<?php if ($newp > 1) { ?>
  <a href="<?php echo "events.html?p=".($newp-1);?>">&laquo;</a>
<?php } for ($i=$_GET[p]; $i<=($newp2 + $_GET[p]); $i++) { if ($i != $newp){ ?>
   <a href="<?php echo "events.html?p=$i";?>"><?php print_r("$i");?></a>
<?php } else { ?>
   <?php print_r("$i");?>
<?php }} if ($newp < $pnums) { ?>
   <a href="<?php echo "events.html?p=".($newp+1);?>">&raquo;</a>
<?php } ?>
allworknoplay is offline  
Reply With Quote