织梦DEDECMS给列表页添加页码,并且第一页不带页码

文章列表页带页码

打开include/arc.listview.class.php,找到:

$this->ParseDMFields($this->PageNo,1);

在这段代码上面加上:

$this->Fields['pagexx'] = $this->PageNo;
$this->ParseTempletsFirst();

文章列表页中引用分页码的标签为:

第{dede:field.pagexx/}页

但是如果使用这样子进行添加的话,那么列表页会都带有页码,第一页我们是不需要带页码的,因此可参考以下代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{dede:field.cseotitle/}-{dede:field name='pagexx' runphp='yes'}if(@me==1){@me = '公司名';}else{@me="第".@me."页-公司名";}{/dede:field}</title>
<meta name="keywords" content="{dede:field.ckeywords/}" />
<meta name="description" content="{dede:field.cdescription/}" />
<link rel="canonical" href="http://www.sdfymb.com{dede:field name='arcurl'/}" />
<link href="/skin/css/style.css" rel="stylesheet" type="text/css" />
</head>

通过上面的代码可以判断是不是第一页,然后如果是第一页就不显示页码

 

posted @ 2019-11-14 14:28  hepeacer  阅读(289)  评论(0)    收藏  举报