0

我正在尝试使用以下代码打印分类术语:

<?php foreach ((array)$taxonomy as $item) { ?>
<a href="<?php print base_path() . "taxonomy/term/" . $item->tid; ?> "class='tags'><?php print $item->name ?>,</a>
<?php } ?>

它在预告片中工作正常,但在完整节点中没有,标签在完整节点中为空。谁能告诉我这是什么原因以及如何解决这个问题?

4

1 回答 1

0

我意识到这是一个老问题,但我想发布我的 Drupal 6 解决方案。

用这个

$tree = taxonomy_get_tree($vid);

然后遍历它以打印出条款:

      foreach ($tree as $term) {
       $path = taxonomy_term_path($term);
       $content .= '<a href="<?php print base_path() . strtolower(str_replace( " ", "-",$term->name)) . '">' . $term->name . '</a>';           
  }
于 2014-03-18T19:51:47.563 回答