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

首頁 > CMS > 帝國Empire > 正文

帝國cms關(guān)鍵字tags相關(guān)文章調(diào)用標(biāo)簽

2024-08-28 12:25:51
字體:
供稿:網(wǎng)友
此代碼有重復(fù)

<?
$taginfo_r=explode(',',$navinfor['infotags']);
if(is_array($taginfo_r)){
        foreach($taginfo_r as $tagname){
                if($tagname){
                        $tagr=$empire->fetch1("select tagid from {$dbtbpre}enewstags where tagname='$tagname' limit 1");
                        if($tagr['tagid']){
                                $tsql=$empire->query("select * from {$dbtbpre}enewstagsdata where tagid=".$tagr['tagid']."");
                                while($tr=$empire->fetch($tsql)){
                                        if($tr['id']==$navinfor['id'] && $tr['classid']==$navinfor['classid']){
                                                continue;
                                        }
                                        if(empty($class_r[$tr['classid']]['tbname']))
                                        {
                                                continue;
                                        }
                                        $infor=$empire->fetch1("select id,classid,shopname,shopurl,newspath,filename,groupid,titleurl,title from {$dbtbpre}ecms_".$class_r[$tr['classid']]['tbname']." where id=".$tr[id]." limit 1");
                                        $ti_url=sys_ReturnBqTitleLink($infor);
                                ?>
      <div class="listsite">
        <ul>
          <li><a href="<?=$ti_url?>/" class="webname2" title="<?=$infor['title']?><?=$infor['shopname']?>"><?=$infor['title']?><?=$infor['shopname']?></a></li>
          <li class="li3"></li>
        </ul>
      </div>
                                <?
                                }
                        }
                }
        }
}
?>
 
此代碼把當(dāng)前文章也包含了
<!--內(nèi)容頁調(diào)用標(biāo)簽開始-->
<?
            $a="$navinfor[infotags]";
            $str=str_replace(',', ',', $a);
            $tag='';
            $t= explode(",", $str);
             
                    for($i=0;$i<count($t);$i++)
                    {
                            if($t[$i])
                            {
?>
                                   [e:loop={"SELECT tagid FROM phome_enewstags WHERE tagname = '".$t[$i]."'",1,24,0}]

                                   [tagsinfo]$bqr[tagid],10,32,21,0,0[/tagsinfo]

                                   [/e:loop]
<?
                            }
            }
            ?>

<!--內(nèi)容頁調(diào)用標(biāo)簽結(jié)束-->


根據(jù)Tags 調(diào)用相關(guān)文章,絕對好用!

以下是具體實現(xiàn)過程:
以下代碼放到/e/class/userfun.php里!

<?php
function user_otherlink($limit=5){
        global $dbtbpre,$empire,$navinfor,$class_r;
    if($navinfor[infotags]){
            $classid=(int)$classid;
        $limit=(int)$limit;
        $tbname=$class_r[$navinfor[classid]][tbname];
        $tagarr=explode(",",$navinfor[infotags]);
        $arr=array();
        $num=ceil($limit/count($tagarr));
        foreach($tagarr as $k=>$v){
                        if(count($tagarr)==$k+1){
                                $num=$limit-count($arr);
                        }else{
                                if($i<$num){
                                        $num=ceil(($limit-count($arr))/count($tagarr));
                                }                
                        }
            $t=$empire->fetch1("select tagid,num from {$dbtbpre}enewstags where tagname='$v'");
                        if($t[tagid]){
                                $sql=$empire->query("select id from {$dbtbpre}enewstagsdata where tagid=$t[tagid]");
                                $i=0;
                                while($s=$empire->fetch($sql)){
                                        if(in_array($s[id],$arr)||$s[id]==$navinfor[id]){
                                                continue;
                                        }else{
                                                $arr[]=$s[id];
                                                $i++;
                                        }
                                        if($i==$num){
                                                break;
                                        }
                                        if(count($arr)==$limit){
                                                break 2;
                                        }
                                }
                                if($t[num]>$num){
                                        $linshi=$t[tagid];
                                }
                        } 
        }
        if(count($arr)>0){
                        $inid=implode(",",$arr);
                        if(count($arr)<$limit&&$linshi){
                                $sql=$empire->query("select id from {$dbtbpre}enewstagsdata where tagid=$linshi and id not in($inid)");
                                while($s=$empire->fetch($sql)){
                                        $arr[]=$s[id];
                                        if(count($arr)==$limit){
                                                break;
                                        }
                                }
                        }
                        $inid=implode(",",$arr);
                        $str="";
                        $news=$empire->query("select id,title,titleurl,titlepic from {$dbtbpre}ecms_{$tbname} where id in($inid)");
                        while($n=$empire->fetch($news)){
                                $str.='<li><a href="'.$n[titleurl].'">'.$n[title].'</a></li>';
                        }        
                }
        return $str;
           }
}
?>


內(nèi)容頁模板用以下代碼調(diào)用:5為顯示數(shù)量 自己改
<?=user_otherlink(5)?>
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 霍山县| 汝南县| 宿松县| 通江县| 同德县| 古蔺县| 丁青县| 九龙县| 岚皋县| 内黄县| 高碑店市| 莒南县| 古丈县| 渭源县| 新源县| 和静县| 阿合奇县| 闻喜县| 佛冈县| 清水河县| 庄浪县| 阳东县| 昌黎县| 南靖县| 梅河口市| 邛崃市| 杂多县| 伊通| 丹寨县| 于都县| 乐清市| 信丰县| 射阳县| 盘山县| 托克逊县| 成安县| 绍兴市| 深泽县| 抚顺市| 怀宁县| 长春市|