帝国cms灵动标签调用信息时输出TAG信息
帝国cms灵动标签调用信息时输出TAG信息2种方法差不多,一种是for,一种是foreach。
方法1:
<?php
$tagStr = '';
$fr = $empire->fetch1("select infotags from {$dbtbpre}ecms_{$class_r[$bqr['classid']]['tbname']}_data_{$bqr['stb']} where id='{$bqr['id']}'");
$TagArr = explode(',', $fr['infotags']);
for ($i = 0; $i < count($TagArr); $i++) {
if($TagArr[$i]){
$tagStr .= '<a href="/e/tags/?tagname=' . $TagArr[$i] . '" target=_blank>' . $TagArr[$i] . '</a>';
}
}
?>
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br>
<?=$tagStr?>
方法2:
<?php
$tagStr = '';
$fr = $empire->fetch1("select infotags from {$dbtbpre}ecms_{$class_r[$bqr['classid']]['tbname']}_data_{$bqr['stb']} where id='{$bqr['id']}'");
$TagArr = explode(',', $fr['infotags']);
foreach ($TagArr as $k => $v) {
if($v){
$tagStr .= '<a href="/e/tags/?tagname=' . $v . '" target=_blank>' . $v . '</a>';
}
}
?>
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br>
<?=$tagStr?>
支持大神,希望继续出技术教程
页:
[1]