php程序翻页问题,在php4服务器中正常翻页,在全能主机中不能正常翻页,点击下一页没有反应
发布网友
发布时间:2022-05-14 09:38
我来回答
共2个回答
热心网友
时间:2022-05-14 11:07
php程序翻页问题,在php4服务器中正常翻页,在全能主机中不能正常翻页,点击下一页没有反应,该页源码如下:
<?php
class pages
{
var $output;
var $file;
var $pvar = "page";
var $psize;
var $curr;
var $varstr;
var $tpage;
function set( $pagesize = 20, $total, $current = false )
{
global $HTTP_SERVER_VARS;
global $HTTP_GET_VARS;
global $htmlstr;
global $MenuInfo;
$this->total = $total;
$this->tpage = ceil( $total / $pagesize );
if ( !$current )
{
$current = $HTTP_GET_VARS[$this->pvar];
}
if ( $this->tpage < $current )
{
$current = $this->tpage;
}
if ( $current < 1 )
{
$current = 1;
}
$this->curr = $current;
$this->psize = $pagesize;
if ( !$this->file )
{
$this->file = $HTTP_SERVER_VARS['PHP_SELF'];
}
$this->output .= "<table cellspacing=1><tr>";
if ( 10 < $current )
{
$this->output .= ( "<td ><a class=pages href=./?".$htmlstr."&".$this->pvar."=".( $current - 10 ) ).$this->varstr." title=\"\"><img src=".ROOTPATH."templates/".$MenuInfo['skin']."/images/2arrow_l_on.gif border=0></a></td>";
}
else
{
$this->output .= "<td ><img src=".ROOTPATH."templates/".$MenuInfo['skin']."/images/2arrow_l_off.gif border=0></td>";
}
if ( 1 < $current )
{
$this->output .= ( "<td ><a class=pages href=./?".$htmlstr."&".$this->pvar."=".( $current - 1 ) ).$this->varstr." title=\"\"><img src=".ROOTPATH."templates/".$MenuInfo['skin']."/images/1arrow_l_on.gif border=0></a></td><td width=3></td>";
}
else
{
$this->output .= "<td ><img src=".ROOTPATH."templates/".$MenuInfo['skin']."/images/1arrow_l_off.gif border=0></td><td width=3></td>";
}
if ( floor( $current / 10 ) == $current / 10 )
{
$start = floor( $current / 10 ) * 10 - 9;
}
else
{
$start = floor( $current / 10 ) * 10 + 1;
}
$end = $start + 9;
if ( $start < 1 )
{
$start = 1;
}
if ( $this->tpage < $end )
{
$end = $this->tpage;
}
$i = $start;
for ( ;$i <= $end;$i++)
{
if ( $current == $i )
{
$this->output .= "<td class=pagesnow><b>[".$i."]</b></td>";
}
else
{
$this->output .= "<td class=pages ><b>[<a class=pages href= \"./?".$htmlstr."&".$this->pvar."=".$i.$this->varstr."\"><b>".$i."</b></a>]<b></td>";
}
}
if ( $current < $this->tpage )
{
$this->output .= ( "<td width=3></td><td style=\"padding-left:3px;padding-right:3px\"><a href=./?".$htmlstr."&".$this->pvar."=".( $current + 1 ) ).$this->varstr." ><img src=".ROOTPATH."templates/".$MenuInfo['skin']."/images/1arrow_r_on.gif border=0></a></td>";
}
else
{
$this->output .= "<td width=3></td><td><img src=".ROOTPATH."templates/".$MenuInfo['skin']."/images/1arrow_r_off.gif border=0></td>";
}
if ( 10 < $this->tpage && 10 <= $this->tpage - $current )
{
$this->output .= ( "<td><a href=./?".$htmlstr."&".$this->pvar."=".( $current + 10 ) ).$this->varstr." ><img src=".ROOTPATH."templates/".$MenuInfo['skin']."/images/2arrow_r_on.gif border=0></a></td>";
}
else
{
$this->output .= "<td><img src=".ROOTPATH."templates/".$MenuInfo['skin']."/images/2arrow_r_off.gif border=0></td>";
}
$this->output .= "</tr></table>";
}
function setvar( $data )
{
foreach ( $data as $k => $v )
{
$this->varstr .= "&".$k."=".urlencode( $v );
}
}
function output( $return = false )
{
if ( $return )
{
return $this->output;
}
else
{
echo $this->output;
}
}
function limit( )
{
return ( $this->curr - 1 ) * $this->psize.",".$this->psize;
}
function shownow( )
{
global $strPagesTotalStart;
global $strPagesTotalEnd;
global $strPagesNowPagesFrom;
global $strPagesNowPagesTo;
global $strPagesNowListFrom;
global $strPagesNowListTo;
global $strNoRecode;
if ( 0 < $this->total )
{
if ( $this->total <= ( $this->curr - 1 ) * $this->psize + $this->psize )
{
return ( $strPagesTotalStart.$this->total.$strPagesTotalEnd." ".$strPagesNowPagesFrom.$this->curr.$strPagesNowPagesTo." ".$strPagesNowListFrom.( ( $this->curr - 1 ) * $this->psize + 1 ) )."-".$this->total.$strPagesNowListTo;
}
else
{
return ( $strPagesTotalStart.$this->total.$strPagesTotalEnd." ".$strPagesNowPagesFrom.$this->curr.$strPagesNowPagesTo." ".$strPagesNowListFrom.( ( $this->curr - 1 ) * $this->psize + 1 ) )."-".( ( $this->curr - 1 ) * $this->psize + $this->psize ).$strPagesNowListTo;
}
}
else
{
return $strNoRecode;
}
}
}
?>
热心网友
时间:2022-05-14 12:25
同问。。