现在很多网站尤其是新闻类网站都有阅读全文功能,当一个页面有多个分页的时候就会显示出这个“在本页阅读全文”的链接,点击这个链接之后就是这篇文章以没有分页出现的形式,这样对用户体验更佳,那么dedecms5.7如何在文章内容页也实现这个功能呢?
下面织梦58就告诉大家具体实现方法:
首先找到并打开/include/arc.archives.class.php文件,在大概第145行左右的位置找到如下代码:
| | 1 | $this->Fields['userip'] = $this->addTableRow['userip']; | 
 | 
在其下面添加如下代码:
| | 1 | $this->Fields['body2'] = $this->addTableRow['body']; | 
 | 
添加完成之后再继续查找如下代码:
| | 1 | $this->dsql->ExecuteNoneQuery("Update `#【分隔符】@__archives` SET ismake=1 WHERE id='".$this->ArcID."'"); | 
 | 
注意查找的时候手动去掉上面的那个【分隔符】字样,找到后在其上面添加如下代码:
| | 02 | if($this->TotalPage > 1) { | 
| 04 | $this->Fields['body2'] = preg_replace('/# p#副标题# e#/U', '',$this->Fields['body2']); | 
| 05 | $this->SplitFields = explode("#p2222#",$this->Fields['body2']); | 
| 06 | $this->Fields['tmptitle'] = (emptyempty($this->Fields['tmptitle']) ? $this->Fields['title'] : $this->Fields['tmptitle']); | 
| 07 | $this->Fields['title'] = $this->Fields['tmptitle']; | 
| 08 | $this->TotalPage = count($this->SplitFields); | 
| 09 | $this->Fields['totalpage'] = $this->TotalPage; | 
| 10 | $TRUEfilenameall = $this->GetTruePath().$fileFirst."_all.".$this->ShortName; | 
| 11 | $this->ParseDMFields(1,0); | 
| 12 | $this->dtp->SaveTo($TRUEfilenameall); | 
| 14 | if($cfg_remote_site=='Y'&& $isremote == 1) | 
| 18 | $remotefile = str_replace(DEDEROOT, '', $TRUEfilename); | 
| 19 | $localfile = '..'.$remotefile; | 
| 21 | $remotedir = preg_replace("#[^\/]*\.html#", '', $remotefile); | 
| 22 | $this->ftp->rmkdir($remotedir); | 
| 23 | $this->ftp->upload($localfile, $remotefile, 'ascii'); | 
 | 
添加完成之后继续在里面查找获得静态页面分页列表的代码,里面有return $PageList;
在其上面添加如下代码:
| | 1 | $PageList.= "<a href='http://q.dedejs.com/".$this->NameFirst."_all.".$this->ShortName."'>阅读全文</a>"; | 
 | 
修改完成后,生成一下内容页就可以看到效果了,当文章内容太多分成多页之后就会在列表后面出现阅读全文的链接了,大家赶快试试放在织梦模板里的效果吧。
	 
	 
	
郑重声明:
本站所有内容均由互联网收集整理、网友上传,并且以计算机技术研究交流为目的,仅供大家参考、学习,不存在任何商业目的与商业用途。
若您需要商业运营或用于其他商业活动,请您购买正版授权并合法使用。
我们不承担任何技术及版权问题,且不对任何资源负法律责任。
如无法下载,联系站长索要。
	如有侵犯您的版权,请给我们来信:cainiaovip8@qq.com,我们尽快处理。