我还是喜欢你,像日月星辰,经久不息。仲夏时节,气候宜人,大地散发着诱人的清香。五彩斑斓的蝴蝶丰容靓饰,顾盼生姿,体态轻盈的蜜蜂乱欢飞舞,寻香弄绿,一派繁忙的景象。
打开include/inc_archives_view.php
大概在444行左右,找到
$this->Fields[$this->SplitPageField]=$this->Fields[$this->SplitPageField];
注释掉,改为
$this->Fields[$this->SplitPageField]=$this->ClickPicNext($this->Fields[$this->SplitPageField]);
然后,最后加上函数,注重在最后一个括号里面!
//把图片替换成链接
//----------------------------
function ClickPicNext(&$body)
{
if($this->NowPage!=$this->TotalPage){
$lPage=$this->NowPage 1;
$body=preg_replace("/<(img|IMG)(.*)(src|SRC)=[\"|'| ]{0,}((.*)>)/isU","<a rel="nofollow noopener noreferrer" href='".$this->NameFirst."_".$lPage.".".$this->ShortName."'>"."\${0}"."</a>",$body);
//$body="<a rel="nofollow noopener noreferrer" href='".$this->NameFirst."_".$lPage.".".$this->ShortName."'>".$body."</a> ";
}else{
if($this->GetNext()){
$body=preg_replace("/<(img|IMG)(.*)(src|SRC)=[\"|'| ]{0,}((.*)>)/isU","<a rel="nofollow noopener noreferrer" href='".$this->GetNext()."'>"."\${0}"."</a>",$body);
//$body="<a rel="nofollow noopener noreferrer" href='".$this->GetNext()."'>".$body."</a> ";
}
}
return $body;
}自动地把文章中的图片替换为下一页的链接,假如是最后一页,则为下一篇!
注重:先要按下面的改法,把上一篇下一篇分开才行!
本文dedecms点击图片进入下一页好代码教程到此结束。不要为失败找借口,只为成功找方法。小编再次感谢大家对我们的支持!