修改文件e/admin/functions.php
搜索查找 GetKeyboard
原来代码
//取得相关链接
function GetKeyboard($keyboard,$keyid,$classid,$id,$link_num){
global $empire,$public_r,$class_r,$fun_r,$dbtbpre;
if($keyid&&$link_num)
{
$add="id in (".$keyid.")";
$tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1");//取得相关链接模板
$temp_r=explode("[!--empirenews.listtemp--]",$tr[otherlinktemp]);
$key_sql=$empire->query("select id,newstime,title,isurl,titleurl,classid,titlepic from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add." order by newstime desc limit $link_num");
while($link_r=$empire->fetch($key_sql))
{
$keyboardtext.=RepOtherTemp($temp_r[1],$link_r,$tr);
}
$keyboardtext=$temp_r[0].$keyboardtext.$temp_r[2];
}
else
{
$keyboardtext=$fun_r['NotLinkNews'];
}
return $keyboardtext;
}
修改为
//取得相关链接
function GetKeyboard($keyboard,$keyid,$classid,$id,$link_num){
global $empire,$public_r,$class_r,$fun_r,$dbtbpre;
if($keyid&&$link_num)
{
$add="a.id in (".$keyid.")";//修改处
$tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1");//取得相关链接模板
$temp_r=explode("[!--empirenews.listtemp--]",$tr[otherlinktemp]);
$key_sql=$empire->query("select a.id,a.newstime,a.title,a.isurl,a.titleurl,a.classid,a.titlepic,b.classname,b.classpath from {$dbtbpre}ecms_".$class_r[$classid][tbname]." as a left join {$dbtbpre}enewsclass as b on a.classid=b.classid where ".$add." order by a.newstime desc limit $link_num");//修改处
while($link_r=$empire->fetch($key_sql))
{
$text=RepOtherTemp($temp_r[1],$link_r,$tr);//修改处
$text=str_replace('[!--add_murl--]',$public_r['add_murl'],$text);//修改处
$text=str_replace('[!--classname--]',$link_r[classname],$text);//修改处
$text=str_replace('[!--classpath--]',$link_r[classpath],$text);//修改处
$keyboardtext.=$text;//修改处
}
$keyboardtext=$temp_r[0].$keyboardtext.$temp_r[2];
}
else
{
$keyboardtext=$fun_r['NotLinkNews'];
}
return $keyboardtext;
}
模板 add_murl 是扩展变量
<div class="list">
<h3><i></i>相关资讯</h3>
<ul>
[!--empirenews.listtemp--]
<li> <a href="[!--add_murl--][!--titleurl--]" title="[!--oldtitle--]"><img src="[!--titlepic--]"/></a>
<div>
<h2><a href="[!--add_murl--][!--titleurl--]" title="[!--oldtitle--]">[!--oldtitle--]</a></h2>
<span><time>[!--newstime--]</time><a href="[!--add_murl--]/[!--classpath--]/">[[!--classname--]]</a></span> </div>
</li>
[!--empirenews.listtemp--]
</ul>
</div>