/var/www/hkosl.com/alliancealliance/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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
    
function pagenav() {
        global 
$limit,$start,$numpage,$page,$year;

        
$parameters "";


        echo 
"<nav class='page_nav'>";
        echo 
"<ul class='pages'>";

        
//previous set page
        
if($numpage && $start > (2*$limit)){
            
$newstart $start-5*$limit;
            if(
$newstart <=0){
                
$newstart 0;
            }

        }

        
//previous page
        
$newstart ="";
        if (
$start-<= 0) {
            
$newstart 0;
        }else{
            
$newstart $start-$limit;
        }
        echo 
"<li class='pgPrev'><a href='".$page."?start=".$newstart.$parameters."'>&lt;</a></li>";

        
//current page > 3
        
if($start/$limit >= 2){
            for (
$i=(($start/$limit)-2);$i<(($start/$limit)+3);$i++) {
                if (((
$i)*$limit)==$start) {
                    echo 
"<li class='page-number pgCurrent'><a>".($i+1)."</a></li>";
                } else {
                    if(
$i >= && $i $numpage){
                        
$newstart=($i)*$limit;
                        echo 
"<li class='page-number'><a href='".$page."?start=".$newstart.$parameters."'>".($i+1)."</a></li>";
                    }

                }
            }
        }else{
            for (
$i=0;$i<5;$i++) {
                if(
$i >= && $i $numpage){
                    if (((
$i)*$limit)==$start) {
                        echo 
"<li class='page-number pgCurrent'><a>".($i+1)."</a></li>";
                    } else {

                        
$newstart=($i)*$limit;
                        echo 
"<li class='page-number'><a href='".$page."?start=".$newstart.$parameters."'>".($i+1)."</a></li>";

                    }
                }
            }
        }




        
//next page
        
if ($start<$limit*($numpage-1)) {
            
$newstart=$start+$limit;
            echo 
"<li class='pgNext'><a href='".$page."?start=".$newstart.$parameters."' >&gt;</a></li>";
        }

        
//next set page
        
if($start/$limit >= 3){
            if((
$start/$limit)+<= $numpage){
                
$newstart=$start+5*$limit;
            }
        }


        echo 
"</ul>";
        echo 
"</nav>";
    } 
// END FUNCTION

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