drupal - Taxonomy list with content counters -
using drupal 7,
i have content type: movie,
it has taxonomy of actors: keanu reeves, christian bale, milla jovovich, etc.
i'd build view lists actors taxonomy count of content matching taxonomy term, example:
keanu reeves (4) christian bale (8) milla jovovich (2) i'm not sure how build view,
i've set view use aggregation, filter: =published, content type=movie, lang=users language,
fields: count(content: actors)
it doesn't seem accomplish goal, please help!
couldn't find way implement via view, here's custom block code replace view.
$vid = 3; //vocabulary id $num_term = 8; //limit maximum terms $query = "select tid, name, count ( select td.tid tid, name, count(td.tid) count taxonomy_term_data td join taxonomy_index tn on td.tid = tn.tid join node n on n.nid = tn.nid td.vid = ". $vid ." , n.status = 1 group td.tid order count desc limit ". $num_term . " ) t order name asc"; $result = db_query($query); foreach($result $term) { if ($term->count > 0) { echo l($term->name, "taxonomy/term/$term->tid").' ('.$term->count.')'.'<br/>'; } } ?>
Comments
Post a Comment