/var/www/(Del)yunfung.com.hk/en/pagenav.php


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
26
27
28
29
30
31
32
33
34
35
36
<?
    
function pagenav() {
        global 
$limit,$offset,$numpage,$where,$catid;
        if (
$where) {
            
$safewhere=urlencode($where);
        }
        echo 
"<TABLE CELLPADDING=0 BORDER=0 CELLSPACING=0 WIDTH=100%><TR><TD ALIGN=left class='pagenav'>";
            if (
$offset>=$limit) {
                
$newoff=$offset-$limit;
                echo 
"<A HREF=\"$PHP_SELF?catid=$catid&offset=$newoff&where=$safewhere\" class='pagenav'>&lt;</A>";
            } else {
                echo 
"&lt;";
            }
            echo 
"&nbsp;";
            for (
$i=1;$i<=$numpage;$i++) {
                if (((
$i-1)*$limit)==$offset) {
                    print 
"<strong><font color='#000000'>$i</font></strong> ";
                } else {
                    
$newoff=($i-1)*$limit;
                    echo 
"<A HREF=\"$PHP_SELF?catid=$catid&offset=$newoff&where=$safewhere\" class='pagenav'>$i</A> ";
                }
            }
            echo 
"&nbsp;";
            if (
$offset!=$limit*($numpage-1)) {
                
$newoff=$offset+$limit;
                echo 
"<A HREF=\"$PHP_SELF?catid=$catid&offset=$newoff&where=$safewhere\" class='pagenav'>&gt;</A>";
            }else{
                echo 
"&gt;";
            }
            echo 
"</TD></TR></TABLE>";

    } 
// END FUNCTION
    
if ($numpage>1) {
        
pagenav();
    }
?>