Display a list of categories and number of posts in each

Create a block with a list of categories and post count next to each, like in this example:
* Illustrator (35)
* InDesign (44)
* Photoshop (178)
* Quark XPress (4)

<?php
 
if (user_access('access content')) {
   
$result = db_query("SELECT term_data.tid, term_data.name, COUNT(*) AS count FROM {vocabulary_node_types} INNER JOIN  {term_data} USING (vid) INNER JOIN {term_node} USING (tid) INNER JOIN {node} USING (nid) WHERE node.status = 1 and vocabulary_node_types.type = 'blog' GROUP BY term_data.tid, term_data.name ORDER BY term_data.name");
   
$items = array();
    while (
$category = db_fetch_object($result)) {
     
$items[] = l($category->name .' ('. $category->count .')', 'taxonomy/term/'. $category->tid);
    }

    return
theme('item_list', $items);
  }
?>

 
 

Drupal is a registered trademark of Dries Buytaert.