帝国CMS二次开发调用当前信息tags

[e:loop={"SELECT * FROM 表前缀_ecms_表名_data_1 WHERE id = '".$navinfor[id]."'",1,24,0}]
<?
$a="$bqr[infotags]";
$str=str_replace(&#39;,&#3

[时间:09-19]    [浏览:]    [放入收藏夹]    [查看详情]
[e:loop={"SELECT * FROM 表前缀_ecms_表名_data_1 WHERE id = '".$navinfor[id]."'",1,24,0}]
            <?
            $a="$bqr[infotags]";
            $str=str_replace(',', ',', $a);
            $tag='';
            $t= explode(",", $str);
            
                    for($i=0;$i<count($t);$i++)
                    {
if($i<count($t)-1){$doudouhao=",";}else{$doudouhao='';}
                            if($t[$i])
                            {
                                    $tag.="<span class='item'><a target='_blank' href='/e/tags/?tempid=15&tagname=".$t[$i]."' title='".$t[$i]."'>".$t[$i]."</a></span>";
                            }
            }
            echo $tag;
            ?>
[/e:loop]

调用当前信息ID,查询信息的infotags,分隔infotags并循环出来,最后合并成一段链接。代码并不复杂,收藏分享给大家,以免以后会用到。

  本文转载自:精准像素:11px.cn ,感谢作者分享实用知识


标签: