最新公告
  • 欢迎您光临 我爱模板网,本站秉承服务宗旨 履行“站长”责任,销售只是起点 服务永无止境! 立即加入钻石VIP
  • 帝国cms列表页模板加上下2个分页

    正文概述 管理员   2025-09-06   6

    1、在/e/class/userfun.php文件里面加入以下代码 。

    //列表模板之列表式分页
    function daixiao360Page($num,$page,$dolink,$type,$totalpage,$line,$ok,$search="",$add){
    	global $fun_r,$public_r;
    	if($num<=$line)
    	{
    		$pager['showpage']='';
    		return $pager;
    	}
    	//文件名
    	if(empty($add['dofile']))
    	{
    		$add['dofile']='index';
    	}
    	//静态页数
    	$repagenum=$add['repagenum'];
    	$page_line=$public_r['listpagelistnum'];
    	$snum=2;
    	//$totalpage=ceil($num/$line);//取得总页数
    	$firststr='<a title="Total record">&nbsp;<b>'.$num.'</b> </a>&nbsp;&nbsp;';
    	//上一页
    	if($page<>1)
    	{
    		$toppage='<a href="'.$dolink.$add['dofile'].$type.'">'.$fun_r['startpage'].'</a>&nbsp;';
    		$pagepr=$page-1;
    		if($pagepr==1)
    		{
    			$prido=$add['dofile'].$type;
    		}
    		else
    		{
    			$prido=$add['dofile'].'_'.$pagepr.$type;
    		}
    		$prepage='<a href="'.$dolink.$prido.'">'.$fun_r['pripage'].'</a>';
    	}
    	//下一页
    	if($page!=$totalpage)
    	{
    		$pagenex=$page+1;
    		$nextpagelink=$repagenum&&$repagenum<$pagenex?eReturnRewritePageLink2($add,$pagenex):$dolink.$add['dofile'].'_'.$pagenex.$type;
    		$lastpagelink=$repagenum&&$repagenum<$totalpage?eReturnRewritePageLink2($add,$totalpage):$dolink.$add['dofile'].'_'.$totalpage.$type;
    		$nextpage='&nbsp;<a href="'.$nextpagelink.'">'.$fun_r['nextpage'].'</a>';
    		$lastpage='&nbsp;<a href="'.$lastpagelink.'">'.$fun_r['lastpage'].'</a>';
    	}
    	$starti=$page-$snum<1?1:$page-$snum;
    	$no=0;
    	for($i=$starti;$i<=$totalpage&&$no<$page_line;$i++)
    	{
    		$no++;
    		if($page==$i)
    		{
    			$is_1="<b>";
    			$is_2="</b>";
    		}
    		elseif($i==1)
    		{
    			$is_1='<a href="'.$dolink.$add['dofile'].$type.'">';
    			$is_2="</a>";
    		}
    		else
    		{
    			$thispagelink=$repagenum&&$repagenum<$i?eReturnRewritePageLink2($add,$i):$dolink.$add['dofile'].'_'.$i.$type;
    			$is_1='<a href="'.$thispagelink.'">';
    			$is_2="</a>";
    		}
    		$returnstr.='&nbsp;'.$is_1.$i.$is_2;
    	}
    	$returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
    	$pager['showpage']=$returnstr;
    	return $pager;
    }

    2、在/e/class/functions.php文件里面找到function ListHtml。

    (1)、找到

    //替换模板变量
    $listtemp=str_replace('[!--newsnav--]',$url,$listtemp);//位置导航

    在其上面加入以下代码

    $daixiao360fun='daixiao360Page';
    $daixiao360Page='[!--daixiao360Page--]';

    (2)、找到

    //取得分页参数			$returnpager=$thefun($num,$pagenum,$dolink,$dotype,$page,$lencord,$ok,$myoptions,$pagefunr);

    在其下面加入以下代码

    $returnpager1=$daixiao360fun($num,$pagenum,$dolink,$dotype,$page,$lencord,$ok,$myoptions,$pagefunr);

    (3)、找到

    $list1=str_replace($bereplistpage,$showpage,$list_r[0]);
    $list2=str_replace($bereplistpage,$showpage,$list_r[2]);

    改成以下代码

    $zuhe=array($bereplistpage,$daixiao360Page);
    $zuhe1=array($showpage,$showpage1);
    $list1=str_replace($zuhe,$zuhe1,$list_r[0]);
    $list2=str_replace($zuhe,$zuhe1,$list_r[2]);

    3,在列表模板里面加入分页代码[!--daixiao360Page--]

    4。效果图如下:


    我爱模板网 » 帝国cms列表页模板加上下2个分页

    发表评论

    如需帝国cms功能定制以及二次开发请联系我们

    联系作者
    script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?587cc1e5c052b5b0ce99533beff13c96"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();

    请选择支付方式

    ×
    支付宝支付
    余额支付
    ×
    微信扫码支付 0 元