loading...

精華 帝國PHP系統CMS內容頁調用TAG的多種方法,PHP和靈動標簽

本帖最后由 梔子花 于10 個月前編輯 只看Ta 樓主

帝國php系統 tags調用非常詳細的方法,都在這了。根據自己需要進行改造即可。

方法1

調用10條當前tag
[showtags]'selfinfo',10,0,'',0,'',' ',0,'','tagname'[/showtags]

方法2

內容頁調用tag,按tagname調用

<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://m.xishiwo.cn/$tagslink' target='_blank'>".$t[$i]."</a> ";
}
}
echo $tag;
?>
</div>

或,按tagname調用

<?php
$fr=$empire->fetch1("select infotags from {$dbtbpre}ecms_news_data_{$navinfor[stb]} where id='$navinfor[id]'");
$infotags=$fr['infotags'];//這個就是infotags字段內容
$tag='';
$t=explode(',',$infotags);//去逗號
$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://m.xishiwo.cn/$tagslink' target='_blank'>".$t[$i]."</a> ";
}
}
echo $tag;
?>

或,按id調用

<?
$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://m.xishiwo.cn/$tagslink' target='_blank'>".$t[$i]."</a> ";
}
}
echo $tag;
?>

注釋:

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

mid=1數據模型id ?tempid=1模型的模板id ? orderby排列方式 ?classid=34欄目id ?&line=5調用條數

如:上面的 &tempid=1

方法3、tags標簽實現多顏色樣式

<?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://m.xishiwo.cn/<?=$public_r[newsurl]?>e/tags/?tagname=<?=$bqr2['tagname']?>&tempid=1"><?=$bqr2[tagname]?></a>

<?php
}
}
?>

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

注釋:mid=1數據模型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://m.xishiwo.cn/<?=$public_r['newsurl']?>e/tags/?tagname=<?=$bqr['tagname']?>' title='<?=$bqr['num']?>個'><?=$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://m.xishiwo.cn/<?=$public_r[newsurl]?>e/tags/?tagname=<?=$tag['tagname']?>"><?=$tag[tagname]?></a></span>&nbsp;
<?}?>

方法6

<?php
$tbname="news"; //“news”為新聞數據表名稱
$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://m.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://m.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://m.xishiwo.cn/$tagslink' target='_blank' rel='tag'>".$r_tag[$i]."</a>";
}
}
?>
tag:<?=$tags?>

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

發帖
請先 登錄 再評論

? 2025挨踢網 - 大家的導航! - iT200.COM 粵ICP備15047905號-9

主站蜘蛛池模板: 国产精品视频播放 | 欧美日韩国产欧美 | 中文字幕一区二区三区精彩视频 | 在线免费观看成人 | 黄色一级大片在线免费看产 | 一区二区三区在线播放 | 国产在线精品免费 | 玖玖在线精品 | 久操国产 | 在线婷婷 | 精品视频在线一区 | 一区中文字幕 | 国产成人网 | 91视频导航 | 国产精品一区二区久久 | 亚洲精品天堂 | 99免费看 | 国产三级日本三级 | 高清av一区| 1000部精品久久久久久久久 | 国产精品久久久久不卡 | 久久久久久国模大尺度人体 | 精品9999| 在线视频a | 国产视频二区在线观看 | 一级黄色片免费在线观看 | 国产成人精品一区二区在线 | 亚洲精品电影网在线观看 | 中文字幕av亚洲精品一部二部 | 国产精品综合 | 欧美一区二区三区在线播放 | 亚洲国产精品久久久久婷婷老年 | 欧洲一级视频 | 国产精品一区二区三区在线 | 精品一区二区三区在线观看国产 | 亚洲国产精品久久久久秋霞不卡 | 性一交一乱一透一a级 | 国产97人人超碰caoprom | 免费a国产 | 亚洲精品久久久久久久久久久久久 | 国产日韩一区二区 |