如何在node.tpl.php (Drupal 7)中使用DISPLAY SUITE的新自定义字段


How to use new custom field of DISPLAY SUITE in node.tpl.php (Drupal 7)

我现在正在做一个drupal 7项目,它基本上是基于facebook这样的社交网络。

我们在其中包括一个模块Heartbeat,其中我们已经完成了一些自定义,并从显示套件模块创建了一个自定义字段。我已经制作了这个自定义字段,它与心跳模块工作良好,但现在我们需要在所有其他实体中显示这个自定义字段,如节点评论用户配置文件等。我努力去做这件事,但没有成功。谁能给我提示如何使用那些自定义显示套件字段node.tpl.php文件??

提前感谢。

问候,Chandresh .

在您的节点中。TPL必须使用以下代码,例如字段名:field_header

 <!-- For Showing only custom field's Value Use below code -->
 <h2 class="title"><?php print $node->field_header['und']['0']['value'];?></h2>
 <!-- ========================= OR  ========================= -->
 <!-- For Showing custom field Use below code , which shows custom field's value and title-->
 <h2 class="title"><?php print render(field_view_field('node', $node, 'field_header'));  ?></h2>
 <!-- ========================= OR  ========================= -->
 <h2 class="title"><?php print render($content['field_header']); ?></h2>