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



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

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

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

使用$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));
?>

最新更新