SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Resistance is Futile webgodjj's Avatar
    Join Date
    Nov 2002
    Location
    Madison, WI USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    page results like this forum

    I really like how the page results look on this forum.. does anyone know how this is made?

    Pages (6): 1 2 3 4 [5] 6

  2. #2
    SitePoint Addict
    Join Date
    Nov 2002
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Search pagedresults or pagedresults.php. It's been a while but I did find it. If you can't find anything PM or email me and I'll send the one I use to you.

    -berzerko

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Location
    Dallas, Texas
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ###########################################
    ## http://hclpfan.elitedesigns.net/Forum/viewtopic.php?t=6 ##
    ###########################################


    there are a couple ways to do it but this is one of the easier yet effective ways...
    Code:
    <?php 
    
    // set this to the number of results you wish on each page 
    $limit=20; 
    
    // if no offset has been passed, offset should be 0 
    if (!$offset) { 
    $offset=0; 
    } 
    
    ?>
    first you would define your variables at the top of the page, thats all you have to alter for it and the rest you don't really have to change anything with it:
    Code:
    </php 
    
    function pagenav() { 
    global $limit,$offset,$numpage,$where; 
    if ($where) { 
    $safewhere=urlencode($where); 
    } 
    echo " 
    <TABLE CELLPADDING=0 BORDER=0 CELLSPACING=5 WIDTH=100> 
    <TR> 
    <TD ALIGN=RIGHT>"; 
    
    if ($offset>=$limit) { 
    $newoff=$offset-$limit; 
    
    echo "<A HREF=""\"$PHP_SELF?offset=$newoff&where=$safewhere\"> 
    &-- PREV</A> 
    </TD>"; 
    } else { 
    echo "&-- PREV"; 
    } 
    
    echo "<TD ALIGN=CENTER> & "; 
    
    for ($i=1;$i<=$numpage;$i++) { 
    if ((($i-1)*$limit)==$offset) { 
    print "$i "; 
    } else { 
    $newoff=($i-1)*$limit;
    
    echo "<A HREF=""\"$PHP_SELF?offset=$newoff&where=$safewhere\"> 
    $i</A> "; 
    } 
    } 
    echo "& </TD> 
    <TD ALIGN=LEFT>"; 
    if ($offset!=$limit*($numpage-1)) { 
    $newoff=$offset+$limit; 
    echo "<A HREF=""\"$PHP_SELF?offset=$newoff&where=$safewhere\"> 
    NEXT--&</A> 
    </TD>"; 
    }else{ 
    echo "NEXT--&</TD>"; 
    } 
    echo "</TR> 
    </TABLE>"; 
    
    } // END FUNCTION 
    
    ?>
    Last edited by HCLPfan; Apr 29, 2003 at 15:10.
    Eternal Fun
    Free flash games, funny videos and flash animations.

  4. #4
    Resistance is Futile webgodjj's Avatar
    Join Date
    Nov 2002
    Location
    Madison, WI USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $limit,$offset,$numpage,$where

    are the variables... but I don't understand what they really are. I understand limit is the amount of items on a page... The rest i'm confused about.

    How would I implement this??? I understand I have to define the variables at the begining, but where do put my mysql statement and output code?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •