2011-12-14 53 views
0

我现在正在研究其中一个drupal 7项目,该项目基本上基于Facebook等社交网络。如何在node.tpl.php(Drupal 7)中使用DISPLAY SUITE的新自定义字段

在那里我们包括模块心跳,在此我们也做了一些定制和从显示套房模块中创建一个自定义字段中的一个。我做了这个自定义字段,并且正在以良好心跳模块,但现在我们需要要求所有其他实体来显示这个自定义字段像节点评论用户配置文件等。 我努力做到这一点,但无法取得成功。谁能给我提示如何使用这些自定义显示套件字段node.tpl.php文件?

在此先感谢。

Regards, Chandresh。

+0

该死。 _更多社交网站。 – Bojangles 2011-12-14 09:35:00

回答

0

在你node.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> 
相关问题