织梦如何使用if判断某个字段是否为空呢?我们以文章页调用文章摘要为例:

使用if语句判断摘要是否为空,如果有摘要就显示摘要模块,如果没有就不显示

{dede:field.description runphp='yes'} 
if (@me <> '') {
  @me = '<div>'.@me.'</div>'; } else {   @me = '';
} {/dede:field.
description}

再比如调用某一栏目文章列表时,使用if判断是文章是否有简略标题,如果有就调用简略标题

{dede:arclist row='10'}
    [field:array runphp='yes']
        if (@me['shorttitle'] == '') {
            @me = @me['title'];
        } else {
            @me = @me['shorttitle'];
        }
    [/field:array]
{/dede:arclist}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2021-12-10
猜你喜欢
  • 2021-05-26
  • 2021-12-10
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2021-12-10
  • 2021-10-29
相关资源
相似解决方案