7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
68 lines
2.4 KiB
PHP
68 lines
2.4 KiB
PHP
<?php
|
|
////////////////// 分页类
|
|
/******************** 使用方法 ******************
|
|
$p=new page;
|
|
////以下参数必需赋值
|
|
$p->offset=$offset; //记录指针
|
|
$p->total=100; //总记录数
|
|
////以下参数可以默认
|
|
$p->page_size=20; //每页显示记录数
|
|
$p->show_page_num=7; //7,9,11
|
|
$p->path=$_SERVER[PHP_SELF]; //跳转地址
|
|
$p->arr_var=array("a"=>$a,"b"=>$b,"c"=>$c); //要传递的其他参数
|
|
////输出
|
|
echo $p->show();
|
|
***********************************************/
|
|
class page1{
|
|
var $total,$offset,$page_size,$arr_var,$style,$show_page_num;
|
|
//显示
|
|
function show(){
|
|
$page_size=($this->page_size)?($this->page_size):20;
|
|
$show_page_num=($this->show_page_num)?($this->show_page_num):9;
|
|
$offset=($this->offset)?($this->offset):0;
|
|
$style=($this->style)?($this->style):1;
|
|
$path=$this->path;
|
|
if($style==1){
|
|
$color1="#000000";
|
|
$color2="#666666";
|
|
}else{
|
|
$color1="#ffffff";
|
|
$color2="#cccccc";
|
|
}
|
|
$total=$this->total;
|
|
$arr_var=$this->arr_var;
|
|
if(is_array($arr_var)){
|
|
foreach($arr_var as $key=>$value){
|
|
$other_var.="&".$key."=".urlencode($value);
|
|
}
|
|
}
|
|
//
|
|
$r_str="<table><tr>";
|
|
$total_page_num=ceil($total/$page_size);
|
|
$total_page_num=$total_page_num>0?$total_page_num:1;
|
|
$this_page=$offset>0?$offset/$page_size+1:1;
|
|
$r_str.="<td>";
|
|
//pre page
|
|
$pre_offset=($this_page-2)*$page_size;
|
|
if($this_page>1)
|
|
$r_str.="<a href=\"".$path."?offset=".$pre_offset.$other_var."\" style='color:".$color1.";'><img src='images/page_pre_b.gif' border=0 align='middle'></a>";
|
|
else
|
|
$r_str.="<img src='images/page_pre_b1.gif' border=0 align='middle'>";
|
|
//middle
|
|
$num_start=($this_page-1)*$page_size+1;
|
|
$num_end=($this_page-1)*$page_size+$page_size;
|
|
$num_end=$num_end>$total?$total:$num_end;
|
|
$r_str.="</td><td class=\"fontWhite\"> <b>(".$num_start."-".$num_end." OF ".$total.")</b> </td><td>";
|
|
//next page
|
|
$next_offset=$this_page*$page_size;
|
|
if($this_page<$total_page_num)
|
|
$r_str.="<a href=\"".$path."?offset=".$next_offset.$other_var."\" style='color:".$color1.";'><img src='images/page_next_b.gif' border=0 align='middle'></a>";
|
|
else
|
|
$r_str.="<img src='images/page_next_b1.gif' border=0 align='middle'>";
|
|
//form
|
|
$r_str.="</td></tr></table>";
|
|
return $r_str;
|
|
}
|
|
}
|
|
////////////////// 分页类结束
|
|
?>
|