很多时间我们都会看到利用DedeCms做的图片网站都支持点击图片进入下一页,点击最后一页图片进入下一篇效果,下面我们来告诉你如何实现这种效果吧.
1、编辑打开include/arc.archives.class.php文件
2、查找“//解析模板,对内容里的变动进行赋值”在这段话上面添加以下代码:
- function clickpicnext($ismake=1,$aid,&$body)
- {
- global $cfg_rewrite;
- if($this->nowpage!=$this->totalpage)
- {
- $lpage=$this->nowpage+1;
- if($ismake=0)
- {
- $body=preg_replace("/<(img|img)(.*)(src|src)=["|'| ]{0,}((.*)>)/isu","点击图片,进入下一页<br/><a href='".$this->namefirst."_".$lpage.".".$this->shortname."'>"."${0}"."</a>",$body);
- }
- else
- {
- $pagelist="<a href='view.php?aid=$aid&pageno=$lpage'>"."${0}"."</a>";
- if($cfg_rewrite == 'y')
- {
- $pagelist = str_replace(".php?aid=","-",$pagelist);
- $pagelist = preg_replace("/&pageno=(d+)/i",'-.html',$pagelist);
- }
- $body=preg_replace("/<(img|img)(.*)(src|src)=["|'| ]{0,}((.*)>)/isu",$pagelist,$body); //开源软件:Vevb.com
- }
- }
- else
- {
- $body=preg_replace("/<(img|img)(.*)(src|src)=["|'| ]{0,}((.*)>)/isu",$this->getprenext('imgnext'),$body);
- }
- return $body;
- }
查找$this->fields[$this->splitpagefield] = $this->splitfields[$pageno - 1]; 在其下面添加:
- if($clickpicnext){
- $this->fields[$this->splitpagefield]=$this->fields[$this->splitpagefield];
- }else{
- $this->fields[$this->splitpagefield]=$this->clickpicnext($ismake,$this->fields['id'],$this->fields[$this->splitpagefield]);
- }
查找$this->prenext['next'] = "下一篇:{$nextrow['title']} ";在其下面添加:
$this->prenext['imgnext'] ="<a href='$mlink'>"."${0}"."</a>";
查找$this->prenext['next'] = "下一篇:没有了 ";在其下面添加:
$this->prenext['imgnext'] ="${0}";
查找:
- else if($gtype=='imgnext')
- {
- $rs = $this->prenext['imgnext'];
- }
在其下面添加:
- else if($gtype=='imgnext')
- {
- $rs = $this->prenext['imgnext'];
- }
新闻热点
疑难解答