国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > 帝國(guó)Empire > 正文

帝國(guó)CMS實(shí)現(xiàn)用tag調(diào)用相關(guān)文章的方法

2024-08-28 12:24:59
字體:
供稿:網(wǎng)友

用tag調(diào)用相關(guān)文章的方法在帝國(guó)官方論壇上有人發(fā)過方法,但所使用的函數(shù)效率太低而且無法制定參數(shù),不好用。東坡網(wǎng)現(xiàn)在使用的也是利用tag調(diào)用相關(guān)文章,非常好用。

一、自定義函數(shù)

自定義函數(shù)user_OtherLink ,將此函數(shù)放入 eclassuserfun.php 文件中。

//根據(jù)tag獲取相關(guān)信息

 

function user_OtherLink($num,$classid=0,$mid=0){

global $dbtbpre,$empire,$navinfor,$class_r;

if(empty($navinfor['infotags'])){

return '暫無相關(guān)信息';

}

if($mid&&$classid&&$class_r[$classid]['modid']!=$mid){

return '暫無相關(guān)信息';

}

$tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1");

$temp_r=explode("[!--empirenews.listtemp--]",$tr['otherlinktemp']);

$str='';

$tagsql=$empire->query("select * from {$dbtbpre}enewstagsdata where id='$navinfor[id]' and classid='$navinfor[classid]'");

$i=0;

$isprint=array();

while($tagr=$empire->fetch($tagsql)){

if($i>=$num){

break;

}

$gsql=$empire->query("select * from {$dbtbpre}enewstagsdata where tagid='$tagr[tagid]'");

while($gr=$empire->fetch($gsql)){

$myprint='id'.$gr['id'].'class'.$gr['classid'];

if(array_search($myprint,$isprint)!==false){

continue;

}

$isprint[]=$myprint;

if($classid&&$classid!=$gr['classid']){

continue;

}

if($mid&&$mid!=$gr['mid']){

continue;

}

if($gr['id']==$navinfor['id']&&$gr['classid']==$navinfor['classid']){

continue;

}

$tbname=$class_r[$gr['classid']]['tbname'];

if(!$tbname||InfoIsInTable($tbname)){

continue;

}

$r=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where id='$gr[id]' limit 1");

if(!$r['id']){

continue;

}

$str.=RepOtherTemp($temp_r[1],$r,$tr);

$i+=1;

if($i>=$num){

break;

}

}

}

$keyboardtext=$temp_r[0].$str.$temp_r[2];

if($str){

return $keyboardtext;

}else{

return '暫無相關(guān)信息';

}

}

二、 使用方法:

函數(shù)說明:user_OtherLink(調(diào)用條數(shù),指定欄目id,指定模型id) ;

相關(guān)文章模板采用的是公共模板里的相關(guān)信息模板。

調(diào)用示例:

 

<?=user_OtherLink(10,0,1)?>
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 潜山县| 阿瓦提县| 房山区| 六盘水市| 西安市| 隆林| 荥阳市| 广州市| 射洪县| 应用必备| 南部县| 冕宁县| 神木县| 重庆市| 千阳县| 云阳县| 建阳市| 青海省| 东山县| 英山县| 海宁市| 昌乐县| 永善县| 内丘县| 扬州市| 吉安市| 上杭县| 山东| 商南县| 鹤山市| 江津市| 栾川县| 佳木斯市| 宁城县| 观塘区| 抚顺市| 砀山县| 新乡县| 南和县| 扎鲁特旗| 托里县|