帝国cms灵动标签的变态用法
提示: 阅读权限:公开
<?php
$jhcr=array(1,2,3);
?>
[e:loop={'select 1',0,24}]
<?
if(!$bqr=current($jhcr))break;
$ecms_bq_sql=$empire->query("select 1");
print_r($bqr);
?>
<?next($jhcr)?>
[/e:loop]
看这个数组遍历
<ul class="right_box">
<span>相关专题<?=$_GET[tagname]?></span>
这里调用当前tag相关的tag,接口地址为http://127.0.0.1:8081/searchtag/当前tagname
<?
$urlt=str_replace(array('2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013','2014','2015','2016','2017','2018','年度'),'',$navinfor['tagname']);
$urlt=urlencode($urlt);
//根据classid取得表名和当前文章id,搜索时进行去重过滤
$datar=jhcfile_get_contents("http://127.0.0.1:8081/searchtag/".$urlt);
$datar=json_decode($datar,true);
//第一部分
$temp='<li><a href="http://www.daodoc.com/zt/{url}/" title="{title}" target="_blank">{title}</a></li>';
$rs='<ul">';
foreach($datar['part1'] as $v){
$url= $v['py'];
$title=$v['tagname'];
$rs.=str_replace('{title}',$title,$temp);
$rs=str_replace('{url}',$url,$rs);
}
echo $rs."</ul>";
?>
</ul>
这里是变态的灵动标签调用方法,有意思吧?
<ul class="right_box">
<span>相关专题<?=$urlt=$_GET[tagname]?></span>
<?
$urlt=urlencode($urlt);
$datar=jhcfile_get_contents("http://127.0.0.1:8081/searchtag/".$urlt);
$datar=json_decode($datar,true);
$datar=$datar["part1"];?>
[e:loop={'select 1',0,24}]
<? if(!$bqr=current($datar))break;next($datar);
$ecms_bq_sql=$empire->query("select 1");
if($bqr['tagname']==$_GET[tagname])continue;?>
<li><a href="/zt/<?=$bqr['py']?>/" title="<?=$bqr['tagname']?>" target="_blank"><?=$bqr['tagname']?></a></li>
[/e:loop]
</ul>
</ul>
站内直通车
[!--temp.bottomnav--]