How can I change this code so that it prints out better? There is a huge gap between the edge of the block and the list bullets:
/**
* Creates a list of node titles selected from multiple vocabularies
* in descending chronological order (most recent first).
* Titles link to full node.
*
* To change vocabularies to select from,
* edit the $vocab_id numbers, retaining the "" marks.
* Value should be a comma separated list of vocabulary id's
*
* To change the number of node titles, edit the $list_no number.
*
* This snippet is tested with Drupal 4.6.x
*
*/
$vocab_id = "36";
$list_no =15;
$sql = "SELECT DISTINCT(node.nid), node.title, node.created FROM node INNER JOIN term_node ON node.nid = term_node.nid JOIN term_data ON term_node.tid = term_data.tid WHERE term_data.vid in ($vocab_id) AND node.status = 1 ORDER BY node.created DESC LIMIT $list_no";
$output .= "<ul>";
$result = db_query($sql);
while ($anode = db_fetch_object($result)) {
$output .= "<li>".l($anode->title, "node/$anode->nid")."</li>";
}
$output .= "</ul>";
print $output;
In another snippet, instead of all the $ output etc above, I saw just
print theme('item_list', $items);
?>
and it does not have the huge gap.
Here is the full code of the latter snippet:
<?php
/**
* This php snippet displays a themed summary list of vocabulary term titles(x) from a specific category
* Where (x) is the number of nodes in each term
*
* Tested and works with Drupal 4.6
* To change the vocabulary references, change the $vocabulary_id value to suit.
*/
$vocabulary_id = 11;
$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) .'