phpcmsv9 列表页分页数量修改

找到phpcms\modules\content\classes路径下

找到content_tag.class 文件

查找里面是否有public function count($data) 函数

如果存在的话

新建m_content_tag.class.php文件

将代码复制到文件中即可

<?php
class MY_wap_tag extends wap_tag{
	//数据库连接
	private $db;
	
	public function __construct() {
		$this->db = pc_base::load_model('content_model');
		$this->position = pc_base::load_model('position_data_model');
		parent::__construct();
	}
	public function count($data) {
        if((int) $data['modelid'] > 0 && !empty($data['keywords'])) {
	        $count = $this->db->set_model($data['modelid'])->count($this->_buildsql($data));
        } else {
            $count =  parent::count($data);
        }
        
        if((int) $data['maxpage'] > 0) {
	        list($start, $pagesize) = explode(",", $data['limit']);
	        $count = min($pagesize * $data['maxpage'], $count);
        }
        return $count;
    }
}

移动端同样,找到对应的路径为phpcms\modules\wap\classes

对应文件是wap_tag.class.php

列表页模板示例:

每页显示20篇文章,分页最大页数为8

{pc:content action="lists" catid="$catid" num="20" order="inputtime DESC" where="$where" page="$page" maxpage="8"}
	{loop $data $r}	 
    {if $r[thumb]}
   	
    	 <div class="H_list">
         <a href="{sjurl($r[url])}" title="{$r[title]}" target="_blank">
                <img src="{thumb($r[thumb],140,110)}" alt="{$r[title]}">
                <h2>{$r[fubiaoti]}</h2>
         </a>
         </div>
	{else}	 
		<div class="H_list img_none">
         <a href="{sjurl($r[url])}" title="{$r[title]}" target="_blank">                
                <h2>{$r[fubiaoti]}</h2>
         </a>
         </div> 
	{/if}	 
     {/loop}
	 {/pc}


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值