Drupal Rubricator


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <div class="rubricator">
  2. <?php
  3. $vid = 1;
  4. $db_result = db_query_range( "SELECT
  5. d.tid,
  6. d.name,
  7. MAX(n.created) AS updated,
  8. COUNT(*) AS count
  9. FROM
  10. {term_data} d
  11. INNER JOIN
  12. {term_node}
  13. USING
  14. (tid)
  15. INNER JOIN
  16. {node} n
  17. USING
  18. (nid)
  19. WHERE
  20. d.vid = %d AND
  21. n.status = 1 AND
  22. n.type = '%s'
  23. GROUP BY
  24. d.tid,
  25. d.name
  26. ORDER BY
  27. COUNT DESC",
  28. $vid, 'my_node_type', 0, 10 );
  29. $items = array();
  30. while ( $category = db_fetch_object( $db_result ) ) {
  31. $items[] = l( $category -> name , 'taxonomy/term/'. $category -> tid ) . ' (' . $category -> count . ')';
  32. }
  33. print theme( 'item_list', $items );
  34. ?>
  35. </div>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.