【发布时间】:2012-04-18 15:26:34
【问题描述】:
我需要以编程方式创建 Drupal 7 网站中使用的标签列表。我正在浏览 api/functions,但找不到像“get_list_of_terms()”这样的东西:-)
我应该如何进行? 谢谢! J.
【问题讨论】:
标签: drupal tags drupal-7 taxonomy
我需要以编程方式创建 Drupal 7 网站中使用的标签列表。我正在浏览 api/functions,但找不到像“get_list_of_terms()”这样的东西:-)
我应该如何进行? 谢谢! J.
【问题讨论】:
标签: drupal tags drupal-7 taxonomy
没错。一个稍微完整的例子是(你可以用你自己的词汇 vid 代替):
if ($terms = taxonomy_get_tree($vocabulary->vid)) {
foreach ($terms as $term) {
// Do something with $term->tid or $term->name
}
}
【讨论】:
要获取特定词汇表的分类术语列表,您可以使用taxonomy_get_tree
【讨论】: