内容页调用tag,按tagname调用

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

?>

或,按tagname调用

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 "; } } echo $tag; ?>

或,按id调用

fetch1("select infotags from {$ftbname} where id='$navinfor[id]'"); $a=$hlt[infotags]; $str=str_replace(',', ',', $a); $tag=''; $t= explode(",", $str); for($i=0;$ifetch1("select tagid from {$dbtbpre}enewstags where tagname='$t[$i]' limit 1"); $tagslink="[!--news.url--]e/tags/?tagid=".$datar[tagid].""; $tag.="".$t[$i]." "; } } echo $tag; ?>

注释:

限制数量,把$i<count($t)修改为$i<count($t)&&$i<限制数量

mid=1数据模型id tempid=1模型的模板id orderby排列方式 classid=34栏目id &line=5调用条数

如:上面的 &tempid=1

如果想用静态以ID的HTML 可以参考下面这个

本文标签:fetch1("select infotags from {$ftbname} where id='$navinfor[id]'"); $a=$hlt[infotags]; $str=str_replace(',', ',', $a); $tag=''; $t= explode(",", $str);

                for($i=1;$i<count($t);$i++)
                {
                        if($t[$i])
                        {    $datar=$empire->fetch1("select tagid from {$dbtbpre}enewstags where tagname='$t[$i]' limit 1");   
                                $tagslink="[!--news.url--]tag/".$datar[tagid].".html";
                                $tag.="<a href='$tagslink' style='color:red;font-size:14px' target='_blank'>".$t[$i]."</a> ";
                        }
        }
        echo $tag;
        ?></p>

————————————————
版权声明:本文为CSDN博主「郑叔敲代码」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_38455627/article/details/84637193

作者:test  创建时间:2023-12-02 19:00
最后编辑:test  更新时间:2024-02-24 11:38