I got this snippet from the handbook but no one is answering my question. I suspect the title of the article might be the issue so I'm posting this here hoping someone will respond.

How can I get this to show with thumbnails (if available) or maybe even a teaser instead?

Show a list of (x) most recent nodes from any of several categories (terms)

<?php
/**
* Creates a list of node titles selected from multiple category terms
* in descending chronological order (most recent first).
* Titles link to full node.
*
* To change category terms to select from,
* edit the $taxd_id numbers, retaining the "" marks.
*
* To change the number of node titles, edit the $list_no number.
*
* This snippet is tested with Drupal 4.6.x
*
*/
$taxo_id = "3,4,14,23";
$list_no =6;
$query = "SELECT DISTINCT(n.nid), n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid in ($taxo_id) AND n.status = 1 ORDER BY n.created DESC LIMIT $list_no";
$sql = db_rewrite_sql($query);
$result = db_query($sql);
$items = array();
while ($anode = db_fetch_object($result)) {
  $items[]= l($anode->title, "node/$anode->nid");
}

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

Comments

brenda003’s picture

For something like this using Views module would probably be better suited, snippets can be buggy or insecure.