Using the link you gave, I came up with a quick module to display a random node for a given taxonomy term in a block. If you have your own module going, you may only need the part given in get_block_content()
. The module is called *test_block* and these files are located within sites/all/modules/test_block
test_block.info
name = Test Block
description = Display a random block for given taxonomy term(s)
dependencies[] = node
core = 6.x
test_block.module
<?php
/**
* Implementation of hook_block()
*/
function test_block_block($op='list', $delta=0, $edit=array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t("Random Node Block");
return $blocks;
case 'view':
$blocks['subject'] = t("Random Node Block");
$blocks['content'] = get_block_content();
return $blocks;
}
}
/**
* Return the HTML teaser of a random node
* for a given taxonomy term
*/
function get_block_content() {
// Comma separated lists of terms tid to display nodes
$terms = '4,6';
$sql = "SELECT n.nid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ($terms) AND n.status = 1 ORDER BY RAND() LIMIT 1";
$nid = db_result(db_query($sql));
if ($nid) {
// Return the node teaser
return node_view(node_load($nid), TRUE);
}
return t('No nodes available for the term(s) given.');
}
For more options on the node display, see node_view()