帝国cms灵动标签/跨表跨栏目调用自定义字段值phpif相等显示A不相等显示B
第1种写法:
<?php
if($navinfor['writer']){
$writer=$navinfor['writer'];
?>
[e:loop={"select titleurl,title,writer from phome_ecms_A where writer ='$navinfor[writer]' limit 1",10,24,0}]
<?
$writer='<a href="'.$bqr['titleurl'].'" target="_blank">'.$bqr['writer'].'</a>';
?>
[/e:loop]
<?php
echo $writer;
}
?>
第2种写法:
<?php
$z=$empire->fetch1("select titleurl,title,writer from phome_ecms_B where id ='$navinfor[id]' limit 1"); //调用本篇文章的作者
$zz=$empire->fetch1("select writer from {$dbtbpre}ecms_A where writer = '$z[writer]'"); //调用本篇文章的作者与A表的所有作者对比
if(empty($zz[writer])) //判断 如果 对比结果为空
{
?>
<?=$navinfor['writer']?>
<?php
}else{ //如果判断结果为真 输出
?>
[e:loop={"select titleurl,title,writer from phome_ecms_A where writer ='$navinfor[writer]' and writer!='' limit 1",10,24,0}]
<a href="<?=$bqr['titleurl']?>" target="_blank"><?=$bqr['writer']?></a>
[/e:loop]
<?php
}
?>
参考,:52历史模板
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。