将词汇表中的术语显示为链接列表的块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将词汇表中的术语显示为链接列表的块相关的知识,希望对你有一定的参考价值。

This is a simple little block that displays a list of terms in a vocabulary as a list of links to /taxonomy/term/tid pages. Items are listed in the order set for the vocabulary. You could probably use the php sort() function to change that if desired.

Be sure to change the $vid to reflect the vocabulary id of the vocabulary you wish to list. Also, you can change the "taxonomy/term/$term->tid" to any path you wish.
  1. <?php
  2. /**
  3. * Lists terms for a specific vocabulary without descriptions.
  4. * Each term links to the corresponding /taxonomy/term/tid listing page.
  5. */
  6. $vid = 1;
  7. $items = array();
  8.  
  9. $terms = taxonomy_get_tree($vid, 0, -1, 1);
  10. foreach($terms as $term){
  11. $items[]= l($term->name, "taxonomy/term/$term->tid");
  12. }
  13. if(count($items)) {
  14. return theme('item_list',$items);
  15. }
  16. ?>

以上是关于将词汇表中的术语显示为链接列表的块的主要内容,如果未能解决你的问题,请参考以下文章

Android:RecyclerView 不显示片段中的列表项

基于词汇的 Drupal 变化展示

首选命名空间前缀列表?

如何将列表视图中的数据从一个片段发送到另一个片段

Drupal 视图过滤使用一个分类术语并使用参数添加另一个过滤器

按方面显示术语(词汇表)