在给道州网设计图片道州时,遇到了调用上一篇、下一篇缩略图的问题,经过几个小时的摸索解决了问题,以下是解决帝国CMS、ECMS6.5调用上下篇缩略图的详细方法:
找到e/class/functions.php
将原始的上一篇,下一篇代码复制(因为是独立出来另外用的),然后修改。
//下一篇
if(strstr($newstemptext,’[!--info.next--]‘))
{
$next_r=$empire->fetch1(“select titleurl,groupid,classid,newspath,filename,id,title from {$dbtbpre}ecms_”.$class_r[$add[classid]][tbname].” where id>$add[id] and classid=’$add[classid]‘ and checked=1 order by id limit 1″);
if(empty($next_r[id]))
{
$infonext=$fun_r['HaveNoNextLink'];
}
else
{
//链接
$nexttitleurl=sys_ReturnBqTitleLink($next_r);
$infonext=”<a href=’”.$nexttitleurl.”‘>”.$next_r[title].”</a>”;
}
$newstempstr=str_replace(‘[!--info.next--]‘,$infonext,$newstempstr);
}
//上一篇
if(strstr($newstemptext,’[!--info.pre--]‘))
{
$next_r=$empire->fetch1(“select titleurl,groupid,classid,newspath,filename,id,title from {$dbtbpre}ecms_”.$class_r[$add[classid]][tbname].” where id<$add[id] and classid=’$add[classid]‘ and checked=1 order by id desc limit 1″);
if(empty($next_r[id]))
{
$infonext=$fun_r['HaveNoNextLink'];
}
else
{
//链接
$nexttitleurl=sys_ReturnBqTitleLink($next_r);
$infonext=”<a href=’”.$nexttitleurl.”‘>”.$next_r[title].”</a>”;
}
$newstempstr=str_replace(‘[!--info.pre--]‘,$infonext,$newstempstr);
}
在给道州网设计图片道州时,主要是新增了titlepic,在select titleurl,groupid,classid,newspath,filename,id,title from新增,成为:
select titleurl,groupid,classid,newspath,filename,id,title,titlepic from
上一篇、下一篇都要新增这个调用缩略图的字段
主要修改了:
info.next改为picinfo.next
$infonext=”<a href=’”.$nexttitleurl.”‘>”.$next_r[title].”</a>”;
改正其为:
$infonext=”<a href=’”.$nexttitleurl.”‘ target=’_self’ class=’nph_btn_nset’ id=’nextSet’><img src=’”.$next_r[titlepic].”‘><span>下一图集 ></span></a>”;
这里根据自己需要去调整。
因为单独调用了上下篇图片缩略图,所以在实际调用时,要替换
info.pre改为picinfo.pre
及
info.next改为picinfo.next
末尾是我新增调用上下篇缩略图代码,插入在——
//链接
$titleurl=sys_ReturnBqTitleLink($add);
$newstempstr=str_replace(‘[!--titleurl--]‘,$titleurl,$newstempstr);
$newstempstr=str_replace(‘[!--page.stats--]‘,$onclick,$newstempstr);
后面即可:
//图集下一篇
if(strstr($newstemptext,’[!--picinfo.next--]‘))
{
$next_r=$empire->fetch1(“select titleurl,groupid,classid,newspath,filename,id,title,titlepic from {$dbtbpre}ecms_”.$class_r[$add[classid]][tbname].” where id>$add[id] and classid=’$add[classid]‘ and checked=1 order by id limit 1″);
if(empty($next_r[id]))
{
$infonext=$fun_r['HaveNoNextLink'];
}
else
{
//链接
$nexttitleurl=sys_ReturnBqTitleLink($next_r);
$infonext=”<a href=’”.$nexttitleurl.”‘ target=’_self’ class=’nph_btn_nset’ id=’nextSet’><img src=’”.$next_r[titlepic].”‘><span>下一图集 ></span></a>”;
}
$newstempstr=str_replace(‘[!--picinfo.next--]‘,$infonext,$newstempstr);
}
//图集上一篇
if(strstr($newstemptext,’[!--picinfo.pre--]‘))
{
$next_r=$empire->fetch1(“select titleurl,groupid,classid,newspath,filename,id,title,titlepic from {$dbtbpre}ecms_”.$class_r[$add[classid]][tbname].” where id<$add[id] and classid=’$add[classid]‘ and checked=1 order by id desc limit 1″);
if(empty($next_r[id]))
{
$infonext=$fun_r['HaveNoNextLink'];
}
else
{
//链接
$nexttitleurl=sys_ReturnBqTitleLink($next_r);
$infonext=”<a href=’”.$nexttitleurl.”‘ target=’_self’ class=’nph_btn_pset’ id=’prevSet’><img src=’”.$next_r[titlepic].”‘><span>< 上一图集</span></a>”;
}
$newstempstr=str_replace(‘[!--picinfo.pre--]‘,$infonext,$newstempstr);
}