⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pages.inc.php

📁 学校网站源码http://您的网址/admin/admin_login.asp 默认登录用户:admin 默认登录密码:admin
💻 PHP
字号:
<?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 .= "&amp;".$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;
		}
	}

}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -