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

📄 page.class.php

📁 STCMS 音乐系统 v2.5 build 090501: 为达到最佳效果
💻 PHP
字号:
<?php
///////////////////////////////////////////////////////////////////
// Author:daong | E-mail: dahongy@gmail.com
// Copyright &copy Http://www.phpstcms.cn
// This is not a free software, please to pay for more functions
// $Id: 2009-05-01 version V2.5 $
///////////////////////////////////////////////////////////////////
class page
{
	var $totalNum=0;
	var $pageNum=20;
	var $totalPage=0;
	var $thisPage=0;
	var $url='';
	var $isFull;
	var $nextPage = 0;
	var $prePage = 0;
	var $up = 0;
	var $down = 0;
	
	function page($thisPage=1,$totalNum=0,$pageNum=0,$url='',$isFull=true)
	{
		$this->thisPage = $thisPage ? $thisPage : 1;
		$this->totalNum = $totalNum;
		$this->pageNum = $pageNum ?$pageNum : $this->pageNum;
		$this->url = $url ? $url : $_SERVER['PHP_SELF'];
		$this->isFull = $isFull;
		$this->totalPage = $this->totalPage($this->totalNum,$this->pageNum);
		$this->nextPage = ($this->thisPage + 1) > $this->totalPage ? $this->totalPage : $this->thisPage+1;
		$this->prePage = ($this->thisPage - 1) > 0 ? ($this->thisPage -1) : 1;
		$this->up = $this->thisPage + 5;
		$this->down = $this->thisPage - 5;
	}
	
	function focusLi($page=0)
	{
		$a = "<a href=\"{$this->url}".($this->isFull ? "&page={$page}" : "?page={$page}")."\">$page</a>";
		$code = "<li class=\"focus\">{$a}</li>";
		return $code;
	}
	
	function li($page=0)
	{
		$a = "<a href=\"{$this->url}".($this->isFull ? "&page={$page}" : "?page={$page}")."\">{$page}</a>";
		$code = "<li>{$a}</li>";
		return $code;
	}
	
	function totalPage($totalNum,$pageNum)
	{
		if(intval($totalNum/$pageNum) == $totalNum/$pageNum)
		{
			$totalPage = $totalNum/$pageNum;
		}
		else
		{
			$totalPage = intval($totalNum/$pageNum) + 1;
		}
		return $totalPage;
	}
	
	function getCode($bool=true)
	{
		$code = "<ul class=\"pageul\">";
		$code .= "<li><a href=\"{$this->url}".($this->isFull ? "&page=1" : "?page=1")."\">棣栭〉</a></li>";
		$code .= "<li><a href=\"{$this->url}".($this->isFull ? "&page={$this->prePage}" : "?page={$this->prePage}")."\">涓婁竴椤

⌨️ 快捷键说明

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