📄 class_page.php
字号:
<?php
class page
{
private $each_disNums;
private $nums;
private $current_page;
private $sub_pages;
private $subPage_link;
private $subPage_type;
private $page_array = array();
private $pageNums;
public $pages;
function __construct($each_disNums, $nums, $current_page, $sub_pages, $subPage_link,
$subPage_type, $ajax = false)
{
$this->each_disNums = intval($each_disNums);
$this->nums = intval($nums);
if (!$current_page)
{
$this->current_page = 1;
} else
{
$this->current_page = intval($current_page);
}
$this->sub_pages = intval($sub_pages);
$this->pageNums = ceil($nums / $each_disNums);
$this->subPage_link = $subPage_link;
$this->subPage_type = $subPage_type;
$this->ajax = $ajax;
$this->subPageCss();
}
function initArray()
{
for ($i = 0; $i < $this->sub_pages; $i++)
{
$this->page_array[$i] = $i;
}
return $this->page_array;
}
function construct_num_Page()
{
if ($this->pageNums < $this->sub_pages)
{
$current_array = array();
for ($i = 0; $i < $this->pageNums; $i++)
{
$current_array[$i] = $i + 1;
}
} else
{
$current_array = $this->initArray();
if ($this->current_page <= 3)
{
for ($i = 0; $i < count($current_array); $i++)
{
$current_array[$i] = $i + 1;
}
} elseif ($this->current_page <= $this->pageNums && $this->current_page > $this->
pageNums - $this->sub_pages + 1)
{
for ($i = 0; $i < count($current_array); $i++)
{
$current_array[$i] = ($this->pageNums) - ($this->sub_pages) + 1 + $i;
}
} else
{
for ($i = 0; $i < count($current_array); $i++)
{
$current_array[$i] = $this->current_page - 2 + $i;
}
}
}
return $current_array;
}
function subPageCss()
{
global $tpl;
$subPageStr = '';
$target = $this->ajax ? 'target="ajaxiframe" ' : '';
if ($this->current_page > 1)
{
$firstPageUrl = $this->subPage_link . '1';
$prewPageUrl = $this->subPage_link . ($this->current_page - 1);
$subPageStr .= '<a ' . $target . 'href="' . $firstPageUrl . '">' . $tpl['棣栭〉'] .
'</a>';
$subPageStr .= '<a ' . $target . 'href="' . $prewPageUrl . '">' . $tpl['涓婁竴椤
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -