如何显示当前项的节点数?

时间:2013-01-17 19:10:36

标签: drupal drupal-7 drupal-views

我尝试通过观点来展示我的分类术语,来自我的vocbulary

现在就像这样

  • term1 name
  • term1 img

我需要添加该术语的所有节点的计数,它看起来像 - >

  • term1 name
  • term1 img
  • 包含* term1的所有节点的数量 *

到目前为止,我的想法是在使用预处理函数后在附加字段中显示 term id ,并运行SQL查询来计算具有该术语的所有节点,

但我认为必须有一个简单的方法,寻找想法

1 个答案:

答案 0 :(得分:0)

这是可用于同一对象的简单方法:

$tid = 'Enter tid number say 5';
$nids = taxonomy_select_nodes($tid, FALSE);
// count node here
$count = count($nids);
// you can load node content here
$nodes = node_load_multiple($nids);
相关问题