I want blocks with different vocabularies and have found a good snippet. I just want the output differently. I am no good at coding so I would appreciate some help.
This is the snippet:

<?php
$vocabulary_id = 13;
$result = db_query("SELECT d.tid, d.name, MAX(n.created) AS updated, COUNT(*) AS count FROM {term_data} d INNER JOIN {term_node} USING (tid) INNER JOIN {node} n USING (nid) WHERE d.vid = $vocabulary_id AND n.status = 1 GROUP BY d.tid, d.name ORDER BY updated DESC, d.name");
$items = array();
while ($category = db_fetch_object($result)) {
$items[] = l($category->name .' ('. $category->count .')', 'taxonomy/term/'. $category->tid) .'<br />';
}
print theme('item_list', $items);
?> 

This gives me a list like this:

* kitchen (3)

* furniture (4)

* garden (2)

I would however want it more simple like this:

kitchen (3)
furniture (4)
garden (2)

What's the change I have to do in my snippet?
Please...

Comments

pbarnett’s picture

If you don't want the items as a list, just replace the code with

$vocabulary_id = 13;
$result = db_query("SELECT d.tid, d.name, MAX(n.created) AS updated, COUNT(*) AS count FROM {term_data} d INNER JOIN {term_node} USING (tid) INNER JOIN {node} n USING (nid) WHERE d.vid = $vocabulary_id AND n.status = 1 GROUP BY d.tid, d.name ORDER BY updated DESC, d.name");
$items = array();
while ($category = db_fetch_object($result)) {
  $output .= l($category->name .' ('. $category->count .')', 'taxonomy/term/'. $category->tid) .'<br />';
}
print $output;
AstaC’s picture

Exactly like that! Thank you very, very much!!