[英]How to display number of nodes with current term?
I try to display my taxonomy terms through views, from my vocbulary 我尝试从我的词汇表中通过视图显示我的分类法术语
now it goes like this 现在像这样
I need to add count of all nodes with that term, and it will look like -> 我需要用该术语添加所有节点的数量,它看起来像->
so far, my idea was to display term id in additional field, after use preprocess function, and run SQL query to count all nodes with that term, 到目前为止,我的想法是在使用预处理功能后,在其他字段中显示术语ID ,然后运行SQL查询以计算具有该术语的所有节点,
but i think there must be a easy way, looking for ideas 但我认为必须有一种简便的方法来寻找想法
That should give you the count 那应该给你数
Ref : http://drupal.org/node/603868#comment-4421144 参考: http : //drupal.org/node/603868#comment-4421144
Here is a simple method available for the same : 这是一个适用于相同方法的简单方法:
$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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.