开发者

Drupal 7: Printing Taxonomy Fields in Page.tpl.php

If you have a field that is on a node, you can use the following code to print the field in your page.tpl.php file:

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

How would you print the same fiel开发者_JAVA技巧d that is attached to a taxonomy page?


Use $tid = $node->field_intro['und'][0]['tid']; to get the Tid number and then call taxonomy_term_load($tid). Once there, use print_r() to figure out how to get at the data you want.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜