帝国cms灵动标签/跨表跨栏目调用自定义字段值phpif相等显示A不相等显示B

使用教程 35
2、第1种写法:<?phpif($navinfor['writer']){  ...
2、第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、第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历史,古诗文模板作者
扫码二维码