內(nèi)容頁調用(yòng)tag,按tagname£★§調用(yòng)
<div class="tagsline">Ta∏∏ gs:<? $a="$navinfor[info•∏ ☆tags]";
£© $str=str_replace(',', ',"∑', $a);
$tag='';
↔® $t= explode(",", $str);
↑↔'
≤δ for($i=0;$i<count($t);$∞¥≤₽i++)
{
$££≈
€≤™if($t[$i])
β← {
÷γ×™ $t≈"✘agslink="[!--news.url--]e/tags/÷©α✔?tagname=".urlencode($t[$i])."&¶↓&tempid=1";
¥λ ¥♠λ¶ $tag.="<a href='$tagslink' '→target='_blank'>".¥₩$t[$i]."</a> ";
÷♠ }
}
π echo $tag;
×∞?>
</div>
或,按tagname調用(yòng)
<?php
$fr=$empire->f₹¶¥δetch1("select infotags fromβ♣ε {$dbtbpre}ecms_news_data_{$navinπ→≤for[stb]} where id='$navinf &or[id]'");
$infotags=$fr['iλ'€nfotags'];//這(zhè)個(gè)就(jiù)是(sh≈ ì)infotags字段內(nèi)容
$ta☆¥ g='';
$t=explode(',',$infotags);//去(q∏< ∏ù)逗号
$d=count($t);
f& or($i=0;$i<count($t);$i++♦β)
{
↔♦₹× if($t[$i])
{
∑↕<
$tagslink="[÷≥÷!--news.url--]e/tags/?tag>←±name=".urlencode($t[$i])♣₽."&tempid=1";
→∑ $tag.="<a href='$tagslα₩ink' target='_blank'>".$t≥≤∞[$i]."</a> ";
}££
}
echo $tag;
?>
或,按id調用(yòng)
<?
$tbname=$cl>→≥♠ass_r[$navinfor['classid']]['t♣®↑≤bname'];
$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= exp• ≥lode(",", $str);
∑ •₩
f'Ω£♣or($i=0;$i<count($t);$i++)
☆" {
δ™ if($t[$i])α÷§×
{ >÷÷✔ $datar=$empire->fetch1("sele₩ λct tagid from {$dbtbpre}enewstags wher>$e tagname='$t[$i]' limit 1");♦✘≠
β≥λ✘ $tagslink="[!--news.ur♥®Ωl--]e/tags/?tagid=".$datar[tagid].♣✘"";
₹★ $tag✔≤'.="<a href='$tagslink' target='_blaβσnk'>".$t[$i]."</a> ";
β∏ }
λ&≈↔ }
echo $ta$←g;
?>
注釋:
限制(zhì)數(shù)量,把$i<count($t)修改為(wè§®i)$i<count($t)&&$'πi<限制(zhì)數(shù)量
mid=1數(shù)據模型id tempid=1模型的(de↓✘)模闆id orderby排列方式 ∏ ☆§; classid=34欄目id ® &line=5調用(yòng)條數(shù)
如(rú):上(shàng)面的(de) &tempid=1↔←
如(rú)果想用(yòng)靜(jìng)态以ID的(de)HTML>" 可(kě)以參考下(xià)面這(zhè)個(g♣↑εè)
<p >本文(wén)标簽:<?
$£ λtbname=$class_r[$navinfor['classid']γ₹£ ]['tbname'];
$ftbname=$dbtbpre."ecms_✘<☆".$tbname."_data_".$navinfor['stb'];
β§♥
$hlt = $empire->fetch1("sel☆®ect infotags from {$ftbname} where i¶✔☆d='$navinfor[id]'");
$a¥$₹=$hlt[infotags];
$st€♠≈♥r=str_replace(',', ',', $a);
Ω≥ ∑ $tag='';
λ₽≠ $t= explode(",", $str);
®$
for♠ ($i=1;$i<count($t);$i++)
×₩↕← {
£©∑ if(¶©$t[$i])
₹✔ { $datar=$empire-&g→'≤t;fetch1("select tagid from {β ®$dbtbpre}enewstags where ta &$gname='$t[$i]' limit 1");
×÷
₩↓•$tagslink="[!--news.url--]tag/".$d☆↕÷<atar[tagid].".html";
" $tag.★λ☆★="<a href='$tagsli♣₩&αnk' style='color:red;font-★β'size:14px' target='_blank≥ ✘Ω'>".$t[$i]."</a> ";↔∑★
∑ }
}
£→∞ echo $tag;
λδ× ?></p>