loading...

精華 帝國(guó)PHP系統(tǒng)CMS內(nèi)容頁(yè)調(diào)用TAG的多種方法,PHP和靈動(dòng)標(biāo)簽

本帖最后由 梔子花 于7 個(gè)月前編輯 只看Ta 樓主

帝國(guó)php系統(tǒng) tags調(diào)用非常詳細(xì)的方法,都在這了。根據(jù)自己需要進(jìn)行改造即可。

方法1

調(diào)用10條當(dāng)前tag
[showtags]'selfinfo',10,0,'',0,'',' ',0,'','tagname'[/showtags]

方法2

內(nèi)容頁(yè)調(diào)用tag,按tagname調(diào)用

<div class="tagsline">Tags:<? $a="$navinfor[infotags]";
$str=str_replace(',', ',', $a);
$tag='';
$t= explode(",", $str);

for($i=0;$i<count($t);$i++)
{
if($t[$i])
{
$tagslink="[!--news.url--]e/tags/?tagname=".urlencode($t[$i])."&tempid=1";
$tag.="<a href='http://www.xishiwo.cn/$tagslink' target='_blank'>".$t[$i]."</a> ";
}
}
echo $tag;
?>
</div>

或,按tagname調(diào)用

<?php
$fr=$empire->fetch1("select infotags from {$dbtbpre}ecms_news_data_{$navinfor[stb]} where id='$navinfor[id]'");
$infotags=$fr['infotags'];//這個(gè)就是infotags字段內(nèi)容
$tag='';
$t=explode(',',$infotags);//去逗號(hào)
$d=count($t);
for($i=0;$i<count($t);$i++)
{
if($t[$i])
{
$tagslink="[!--news.url--]e/tags/?tagname=".urlencode($t[$i])."&tempid=1";
$tag.="<a href='http://www.xishiwo.cn/$tagslink' target='_blank'>".$t[$i]."</a> ";
}
}
echo $tag;
?>

或,按id調(diào)用

<?
$tbname=$class_r[$navinfor['classid']]['tbname'];
$ftbname=$dbtbpre."ecms_".$tbname."_data_".$navinfor['stb'];
$hlt = $empire->fetch1("select infotags from {$ftbname} where id='$navinfor[id]'");
$a=$hlt[infotags];
$str=str_replace(',', ',', $a);
$tag='';
$t= explode(",", $str);

for($i=0;$i<count($t);$i++)
{
if($t[$i])
{ ? ?$datar=$empire->fetch1("select tagid from {$dbtbpre}enewstags where tagname='$t[$i]' limit 1");
$tagslink="[!--news.url--]e/tags/?tagid=".$datar[tagid]."";
$tag.="<a href='http://www.xishiwo.cn/$tagslink' target='_blank'>".$t[$i]."</a> ";
}
}
echo $tag;
?>

注釋:

限制數(shù)量,把$i<count($t)修改為$i<count($t)&&$i<限制數(shù)量

mid=1數(shù)據(jù)模型id ?tempid=1模型的模板id ? orderby排列方式 ?classid=34欄目id ?&line=5調(diào)用條數(shù)

如:上面的 &tempid=1

方法3、tags標(biāo)簽實(shí)現(xiàn)多顏色樣式

<?php
$ecms_bq_sql=sys_ReturnEcmsLoopBq("select * from [!db.pre!]enewstagsdata where classid='$navinfor[classid]' and id='$navinfor[id]' order by tagid",10,24,0);
$bqno=0;
while($bqr=$empire->fetch($ecms_bq_sql))
{
$bqsr=sys_ReturnEcmsLoopStext($bqr);
$bqno++;
?>

<?php
$ecms_bq_sql2=sys_ReturnEcmsLoopBq("select * from [!db.pre!]enewstags where tagid='$bqr[tagid]' order by tagid",1,24,0);
$bqno2=0;
while($bqr2=$empire->fetch($ecms_bq_sql2))
{
$bqsr2=sys_ReturnEcmsLoopStext($bqr2);
$bqno2++;
?>

<a class="tag-<?=$bqno?>" href="http://www.xishiwo.cn/<?=$public_r[newsurl]?>e/tags/?tagname=<?=$bqr2['tagname']?>&tempid=1"><?=$bqr2[tagname]?></a>

<?php
}
}
?>

接著在css中定義標(biāo)簽的樣式,這個(gè)可以自己定義。
.tag-1{background:#ff7094;}
.tag-2{background:#94b770;}
.tag-3{background:#db94ff;}
.tag-4{background:#399;}
.tag-5{background:#f60;}

注釋:mid=1數(shù)據(jù)模型id ?tempid=1模型的模板id ? orderby排列方式 ?classid=34欄目id

如:上面的 &tempid=1

方法4、

[e:loop={"select a.*,b.* from [!db.pre!]enewstags a LEFT JOIN [!db.pre!]enewstagsdata b ON a.tagid=b.tagid where b.classid='$navinfor[classid]' and b.id='$navinfor[id]' group by b.tagid order by a.num desc limit 100",0,24,0}]
<a href='http://www.xishiwo.cn/<?=$public_r['newsurl']?>e/tags/?tagname=<?=$bqr['tagname']?>' title='<?=$bqr['num']?>個(gè)'><?=$bqr['tagname']?>(<?=$bqr['num']?>)</a>
[/e:loop]

方法5

<?php
$tsql=$empire->query("select * from {$dbtbpre}enewstagsdata where id='$navinfor[id]'order by id asc limit 7");
while($tr=$empire->fetch($tsql)){
$tag=$empire->fetch1("select * from {$dbtbpre}enewstags where tagid='$tr[tagid]' limit 1");
?>
<span><a class="tag" href="http://www.xishiwo.cn/<?=$public_r[newsurl]?>e/tags/?tagname=<?=$tag['tagname']?>"><?=$tag[tagname]?></a></span>&nbsp;
<?}?>

方法6

<?php
$tbname="news"; //“news”為新聞數(shù)據(jù)表名稱
$ftbname=$dbtbpre."ecms_".$tbname."_data_".$navinfor['stb'];
$hlt = $empire->fetch1("select infotags from {$ftbname} where id='$navinfor[id]'");
$keyr=explode(',',$hlt[infotags]);
for($i=0;$i<count($keyr);$i++)
{
echo '<a href="http://www.xishiwo.cn/384.html'.$public_r[newsurl].'e/tags/?tagname='.$keyr[$i].'" target=_blank>'.$keyr[$i].'</a>&nbsp;&nbsp;';
}
?>

<?php
$fr=$empire->fetch1("select infotags from {$dbtbpre}ecms_news_data_{$navinfor[stb]} where id='$navinfor[id]'");
$keyr=explode(',',$fr[infotags]);
for($i=0;$i<count($keyr);$i++)
{
echo '<a href="http://www.xishiwo.cn/384.html'.$public_r[newsurl].'e/tags/?tagname='.$keyr[$i].'" target=_blank>'.$keyr[$i].'</a>&nbsp;&nbsp;';
}
?>

<?php
$fr=$empire->fetch1("select infotags from {$dbtbpre}ecms_news_data_{$navinfor[stb]} where id='$navinfor[id]'");
$infotags=$fr['infotags'];
$r_tag=explode(",",$infotags);
for($i=0;$i<count($r_tag);$i++){
if($r_tag[$i]){
$tagslink=$public_r[newsurl]."e/tags/?tagname=".urlencode($r_tag[$i]);
$tags.="<a class='tag-link19' href='http://www.xishiwo.cn/$tagslink' target='_blank' rel='tag'>".$r_tag[$i]."</a>";
}
}
?>
tag:<?=$tags?>

注釋:限制數(shù)量,把$i<count($keyr)修改為$i<count($keyr)&&$i<限制數(shù)量?

發(fā)帖
請(qǐng)先 登錄 再評(píng)論

? 2025挨踢網(wǎng) - 大家的導(dǎo)航! - iT200.COM 粵ICP備15047905號(hào)-9

主站蜘蛛池模板: 欧美精品一区二区三区在线播放 | 九九导航 | 中文字幕人成人 | 能看的av网站 | 国产欧美一区二区三区日本久久久 | 97人人澡人人爽91综合色 | 久草视频2 | 日日艹夜夜艹 | 欧美精品在线观看 | 91精品国产91久久久久久最新 | 福利网站在线观看 | 国产内谢 | 国产精品视频久久 | 天天天插 | 中文字幕在线视频免费视频 | 久久中文字幕一区 | 亚洲字幕在线观看 | 国产精品视频网 | 最近最新中文字幕 | 久久三级影院 | 精品久久国产视频 | 色视频在线播放 | 亚洲高清在线观看 | 午夜免费网站 | 亚洲导航深夜福利涩涩屋 | 成人av免费 | 91视频三区| 国产日韩av一区二区 | 精品国产欧美 | 国产精品美女久久久av超清 | 久久精品一 | 一a级片 | 久久精品国产免费一区二区三区 | 国产精品久久久久久久久久久久 | 成人国内精品久久久久一区 | 国产精品日韩欧美 | av看片网站 | 成人欧美一区二区三区黑人孕妇 | 国产精品毛片久久久久久 | 中文字幕韩在线第一页 | 精品av|