Drupal 7(在页面 tpl 上打印渲染图像)

Drupal 7 (Print render image on page tpl)

我似乎无法在 page.tpl.php 上打印渲染图像。

这是我使用的代码:

<?php print render($content['field_image']); ?>

我可以显示标题:<?php print $title; ?>

那我做错了什么?

因为您在 page.tpl 而不是 node.tpl,所以 field_image 不在 $content。 $content 中唯一的东西应该是包含块的区域。

改用这个:https://www.drupal.org/project/fieldblock

在这里您可以将字段用作块。很简单:)