网站栏目页及列表页要实现的效果如下:
1、栏目页最多只列出100页;
2、列表页不限制最大页数,有多少页就列出多少页。
要实现这个效果,需要改动的文件有3个,文件及改动内容如下:
复制代码代码如下:
/*
文件:/include/global.func.php
函数:get
*/
/*
为 get 函数添加一个参数
ismaxpage 就是所添加的参数,用于判断是否启用“列表页最大页数”这个参数
而插入代码的部分是为了改变total的值,即记录集总数
*/
function get($sql, $rows = 0, $page = 0, $dbname = '', $dbsource = '', $urlrule = '', $distinct_field = '', $catid = 0, $ismaxpage = 0) {
...
if($dbname || $dbsource)
{
$r = $db->get_one("SELECT COUNT(*) AS `count` ".stristr($sql, 'from'));
$total = $r['count'];
}
elseif($distinct_field)
{
$total = cache_count("SELEC