帝国cms

推荐列表 站点导航

当前位置:首页 > 建站教程 > 帝国cms >

帝国CMS没有相关信息时调用其它信息教程

来源:网络整理  作者:网络  发布时间:2020-12-09 04:16
帝国CMS模板网下面的帝国CMS教程栏目为您提供了帝国CMS没有相关信息时调用其它信息教程...

这个函数满足我一个小站的功能,对于其它网站来说,补充调用信息可能比较简陋,可以自行修改。

当信息有相关信息时,调用相关信息,如果没有,则调用同栏目、当前信息前后100个id之内的信息中发布时间最靠近的,100可以设置成参数。将此函数放进 userfun.php 文件中,

function dp_GetKeyboard($num=100){ global $empire,$public_r,$class_r,$fun_r,$dbtbpre,$class_r,$navinfor; $keyid=$navinfor['keyid']; $classid=$navinfor['classid']; $id=$navinfor['id']; $link_num=$class_r[$classid]['link_num']; if(!$link_num){ return $fun_r['NotLinkNews']; } $tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1"); $temp_r=explode("[!--empirenews.listtemp--]",$tr[otherlinktemp]); if($keyid){ $add="id in (".$keyid.")"; }else{ $e=$id+$num; $s=$id-$num; $add=" classid=".$classid." and id>".$s." and id<".$e; } $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)){ if($link_r['id']==$id){ continue; } $keyboardtext.=RepOtherTemp($temp_r[1],$link_r,$tr); } if(empty($keyboardtext)){ return $fun_r['NotLinkNews']; } $keyboardtext=$temp_r[0].$keyboardtext.$temp_r[2]; return $keyboardtext; }

在模板中调用方法:<!--?=dp_getkeyboard(200)?-->

帝国cms默认的[!--other.link--]标签调用相关链接时,如果没有相关链接的话,则会显示“暂无相关链接”。对于一些采集站或其他需要增加内链的网站来说,此时最好能调用本栏目的其它一些信息填充进来。这里分享一个自己用的函数,实现这个功能。

相关热词: 调用 帝国cms 教程

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://www.juheyunku.com/jz/ecms/1666.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

帝国CMS没有相关信息时调用其它信息教程

2020-12-09 编辑:网络

这个函数满足我一个小站的功能,对于其它网站来说,补充调用信息可能比较简陋,可以自行修改。

当信息有相关信息时,调用相关信息,如果没有,则调用同栏目、当前信息前后100个id之内的信息中发布时间最靠近的,100可以设置成参数。将此函数放进 userfun.php 文件中,

function dp_GetKeyboard($num=100){ global $empire,$public_r,$class_r,$fun_r,$dbtbpre,$class_r,$navinfor; $keyid=$navinfor['keyid']; $classid=$navinfor['classid']; $id=$navinfor['id']; $link_num=$class_r[$classid]['link_num']; if(!$link_num){ return $fun_r['NotLinkNews']; } $tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1"); $temp_r=explode("[!--empirenews.listtemp--]",$tr[otherlinktemp]); if($keyid){ $add="id in (".$keyid.")"; }else{ $e=$id+$num; $s=$id-$num; $add=" classid=".$classid." and id>".$s." and id<".$e; } $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)){ if($link_r['id']==$id){ continue; } $keyboardtext.=RepOtherTemp($temp_r[1],$link_r,$tr); } if(empty($keyboardtext)){ return $fun_r['NotLinkNews']; } $keyboardtext=$temp_r[0].$keyboardtext.$temp_r[2]; return $keyboardtext; }

在模板中调用方法:<!--?=dp_getkeyboard(200)?-->

帝国cms默认的[!--other.link--]标签调用相关链接时,如果没有相关链接的话,则会显示“暂无相关链接”。对于一些采集站或其他需要增加内链的网站来说,此时最好能调用本栏目的其它一些信息填充进来。这里分享一个自己用的函数,实现这个功能。

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://www.juheyunku.com/jz/ecms/1666.shtml

相关文章

风云图片

推荐阅读

返回帝国cms频道首页