织梦dedecms文章分页时只让摘要出现在第一页

92建站   织梦CMS   2021-05-23   收藏本文

本文介绍了织梦dedecms文章分页时只让摘要出现在第一页,有些站长喜欢在文章的最前面写个摘要,这样可能对于SEO优化有帮助,不过要是文章过分就要发页,如果每个分页都设置同样的摘要也不合理,所以让摘要只出现在第一页还是有必要的。

旺铺招租1 旺铺招租2 旺铺招租3

以前92建站和大家分享过上一篇下一篇增加文章摘要的方法,下面再和大家分享下织梦文章分页时只让摘要出现在第一页的方法:

实现教程:

打开 /include/arc.archives.class.php  

在找到ParseDMFields方法,在方法里面把

if($pageNo>1) $this->Fields['description'] = trim(preg_replace("/[\r\n\t]/", ' ', cn_substr(html2text($this->Fields[$this->SplitPageField]), 200))); 

修改成

if($pageNo>1) $this->Fields['description'] = '';  

它这里的意思就是,当页数大于0的时候 摘要就为空。

修改之后的结果就是

$this->NowPage = $pageNo; $this->Fields['nowpage'] = $this->NowPage; if($this->SplitPageField!='' && isset($this->Fields[$this->SplitPageField])) { $this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1]; //if($pageNo>1) $this->Fields['description'] = trim(preg_replace("/[\r\n\t]/", ' ', cn_substr(html2text($this->Fields[$this->SplitPageField]), 200))); if($pageNo>1) $this->Fields['description'] = ''; }

然后在模板调用的调用:

{dede:field.description runphp='yes'} if(@me<>'' )@me = '<div>'.@me.'</div>'; {/dede:field.description}

这样就可以了 。

上面就是织梦文章分页的介绍,若有疑问可以找小编进一步探讨交流~

TAG标签: 织梦文章分页
旺铺招租4
旺铺招租5
展开