This php block is not working. It trys to get all the nodes in the same taxonomy that the currently viewed is in.
<?php
//limit for number of nodes
$limit = 30;
//the function to get nodes from a certain taxonomy
function get_nodes($tid, $limit)
{
$result = db_query(db_rewrite_sql("SELECT node.title, node.nid FROM node INNER JOIN term_node ON node.nid = term_node.nid WHERE term_node.tid = %d"), $tid);
while ($anode = db_fetch_object($result))
{
$result2 = db_query(db_rewrite_sql("SELECT flexinode_data.numeric_data FROM flexinode_data WHERE flexinode_data.field_id = 3 AND flexinode_data.nid = %d"), $anode->nid);
$front2 = db_fetch_object($result2);
if($front2->numeric_data == 1)
{
$items[] = '
'.l($anode->title, "node/". $anode->nid).'
';
}
else
{
$items[] = l($anode->title, "node/". $anode->nid);
}
}
if(!$items)
{
return;
}
else
{
$output = "
";
foreach ($items as $item)
{
$output .= '
- '. $item .'
';
}
$output .= "
";
return $output;
}
}
$terms = taxonomy_node_get_terms(arg(1));
if ( count($terms) ) {
$first_term = array_pop($terms);
$nodes = get_nodes($first_term->tid, $limit);
if ($nodes) {
$output .= $nodes;
$output .= "
\n
";
}
}