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

时间:2024年06月03日

/

来源:网络

/

编辑:佚名

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历史,古诗文模板作者
猜你需要

豫ICP备2021026617号-1  豫公网安备:41172602000185   Copyright © 2021-2028 www.78moban.com/ All Rights Reserved

本站作品均来自互联网,转载目的在于传递更多信息,并不代表本站赞同其观点和对其真实性负责。如有侵犯您的版权,请联系 1565229909#qq.com(把#改成@),我们将立即处理。