DedeCms图片模型实现点击图片进入下一页
网络整理 - 07-21
此教程教大家如何实现DedeCms图片模型,点击图片进入下一张图片,最后一张图片进入下一篇图片。
亲测DedeCms5.7SP1和DedeCms5.7其他版本未测试,请慎用。
首先打开include/arc.archives.class.php
1、672行处插入,即解析模板,对内容里的变动进行赋值上一行:
//点击进入下一页 function ClickPicNext($ismake=1,$aid,&$body) { global $cfg_rewrite; if($this->NowPage!=$this->TotalPage) { $lPage=$this->NowPage+1; if($ismake==1) { $body=preg_replace("/<(img|IMG)(.*)(src|SRC)=[\"|'| ]{0,}((.*)>)/isU","<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",'-\\1.html',$PageList); } $body=preg_replace("/<(img|IMG)(.*)(src|SRC)=[\"|'| ]{0,}((.*)>)/isU",$PageList,$body); } } else { $body=preg_replace("/<(img|IMG)(.*)(src|SRC)=[\"|'| ]{0,}((.*)>)/isU",$this->GetPreNext('imgnext'),$body); } return $body; }2、在
$this->PreNext['next'] = "下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";下面插入,大概在825行:
$this->PreNext['imgnext'] ="<a href='$mlink'>"."\${0}"."</a>";3、在
$this->PreNext['next'] = "下一篇:没有了 ";下面插入,大概在830行:
$this->PreNext['imgnext'] ="<a href='$mlink'>"."\${0}"."</a>";4、在
$this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1];下面插入,大概在715行:
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]); }5、在
else if($gtype=='nextimg'){ $rs = $this->PreNext['nextimg']; }下面插入,大概在849行:
else if($gtype=='imgnext') { $rs = $this->PreNext['imgnext']; }修改上面四处即可实现点击图片进入下一张图片,点击最后一张图片进入下一篇图集。
修改的时候请注意备份,以免出错。