muban大师 发表于 2021-2-22 11:41:02

织梦如何让摘要只出现在文章的第一页

其实在织梦dedecms前台显示的时候,所有对文章内容的解析都是通过/include/arc.archives.class.php 进行处理的,所有列表页的解析都是通过 /include/arc.listview.class.php进行处理的,
       
        所以我们得走arc.archives.class.php里面去找。要想读懂织梦dedecms里面的全部代码,还是有一些难度,反正我是还没有完全把里面的代码搞懂。
       
        我还是直接说方法吧,打开 /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 = ''.@me.''; {/dede:field.description}
页: [1]
查看完整版本: 织梦如何让摘要只出现在文章的第一页