【问题标题】:Drupal 7: Printing Taxonomy Fields in Page.tpl.phpDrupal 7:在 Page.tpl.php 中打印分类字段
【发布时间】:2011-06-05 17:04:03
【问题描述】:

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

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

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

【问题讨论】:

    标签: drupal-7 drupal-taxonomy


    【解决方案1】:

    使用$tid = $node-&gt;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));
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-28
      相关资源
      最近更新 更多