/var/www/airchats.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
37
38
39
40
41
42
43
44
45
46
<?php
    
function pagenav() {
        global 
$limit,$offset,$numpage,$where;
        if (
$where) {
            
$safewhere=urlencode($where);
        }
            
//<div class='pagination'><a href="#">< &nbsp; Previous</a> | <a href="#">Next &nbsp; ></a></div>
            
echo "<div class='pagination'>";
                
//echo "<ul>";
            
if ($offset>=$limit) {
                
$newoff=$offset-$limit;
                
//echo "<li><a href=\"$PHP_SELF?catid=$catid&offset=$newoff&where=$safewhere#show\" class='prevnext'>Previous</a></li>";
                
echo "<a href=\"$PHP_SELF?pid=".$_GET['pid']."&catid=".$_GET['catid']."&sort=".$_GET['sort']."&offset=$newoff&where=$safewhere#show\">< &nbsp; Previous</a>";
                
//echo "<li><a href=\"$PHP_SELF?catid=$catid&offset=$newoff&where=$safewhere#show\" >&lt;</a></li>";
            
} else {
                
//echo "<li><a class='prevnext disablelink'>Previous</a></li>";
                
echo "<a href=\"$PHP_SELF?pid=".$_GET['pid']."&catid=".$_GET['catid']."&sort=".$_GET['sort']."&offset=$newoff&where=$safewhere#show\">< &nbsp; Previous</a>";
                
//echo "<li><a class='currentpage'>&lt;</a></li>";
            
}
            for (
$i=1;$i<=$numpage;$i++) {
                if (((
$i-1)*$limit)==$offset) {
                    
//echo "<li><a class='currentpage'>$i</a></li>";                    
                
} else {
                    
$newoff=($i-1)*$limit;
                    
//echo "<li><a href=\"$PHP_SELF?catid=$catid&offset=$newoff&where=$safewhere#show\">$i</a></li>";
                
}
            }
            if (
$offset!=$limit*($numpage-1)) {
                
$newoff=$offset+$limit;
                
//echo "<li><a href=\"$PHP_SELF?catid=$catid&offset=$newoff&where=$safewhere#show\" >&gt;</a></li>";
                //echo "<li><a href=\"$PHP_SELF?catid=$catid&offset=$newoff&where=$safewhere#show\" class='prevnext'>Next</a></li>";
                
echo " | <a href=\"$PHP_SELF?pid=".$_GET['pid']."&catid=".$_GET['catid']."&sort=".$_GET['sort']."&offset=$newoff&where=$safewhere#show\">Next &nbsp; ></a>";                
            }else{
                
//echo "<li><a class='currentpage'>&gt;</a></li>";
                //echo "<li><a class='prevnext disablelink'>Next</a></li>";
                
echo " | <a href=\"$PHP_SELF?pid=".$_GET['pid']."&catid=".$_GET['catid']."&sort=".$_GET['sort']."&offset=$newoff&where=$safewhere#show\">Next &nbsp; ></a>";                
            }
            echo 
"</ul>";
            echo 
"</div>";

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