【问题标题】:Drupal 7, displaying page custom field with handling null exceptionsDrupal 7,显示处理空异常的页面自定义字段
【发布时间】:2011-08-13 23:50:36
【问题描述】:
 <?php if ($content['field_banner']): ?>
            <div class="proj"><?php print render($content['field_banner']) ?></div>
            <?php endif; ?>

我的 if 条件不起作用,如果页面没有横幅,我收到一个错误: 注意:未定义索引:include() 中的 field_banner(node.tpl.php 的第 28 行

【问题讨论】:

    标签: drupal-7 drupal-theming


    【解决方案1】:

    也许一点 isset() 可以有所作为。

    <?php if (isset($content['field_banner'])): ?>
    

    【讨论】:

      猜你喜欢
      • 2015-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-28
      相关资源
      最近更新 更多