Posted By

daipratt on 01/22/10


Tagged

drupal taxonomy


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

EkTrOn
Onfire60


Drupal - Show the taxonomy in the format - "term(node count)" - for a given vocabulary


 / Published in: Other
 

  1. <h4>Tags</h4>
  2. <ul>
  3. <?php
  4. $vid = 1;
  5. $vocab = taxonomy_get_tree($vid);
  6.  
  7. $terms = array();
  8. foreach ($vocab as $key=>$value) {
  9. $count = db_result(db_query("SELECT COUNT(nid) as count FROM {term_node} WHERE tid = %d", $vocab[$key]->tid));
  10. print '<li><a href="/'.drupal_get_path_alias('taxonomy/term/'.$vocab[$key]->tid).'">'.$vocab[$key]->name.'</a> ('.$count.')</li>';
  11. }
  12. ?>
  13. </ul>

Report this snippet  

You need to login to post a comment.