Drupal 7:在Page.tpl.php中打印分类字段

时间:2011-06-05 17:04:04

标签: drupal-7 drupal-taxonomy

如果您有一个节点上的字段,您可以使用以下代码在page.tpl.php文件中打印该字段:

<?php print $node->field_intro['und'][0]['value'];?>

您如何打印附加到分类页面的相同字段?

1 个答案:

答案 0 :(得分:3)

使用$tid = $node->field_intro['und'][0]['tid'];获取Tid号码,然后拨打taxonomy_term_load($tid)。在那里,使用print_r()找出如何获取所需的数据。

<?php 
     $tid = $node->field_intro['und'][0]['tid'];
     print_r(taxonomy_term_load($tid));
?>