Creating a Block with links belonging to certain taxonomy terms

Question

war_boar wrote:

how to have a block of links to all terms which match taxonomy like Reviews: Anime Or Reviews: Movies without doing it manually

it should be titled, Reviews and underneath all blogs or stories which matched.

Answer

You might want to use the Taxonomy Menu module.

You will need to create a new Block of type=php. You will then want to paste in the code below, and customize the 'Physicians' subject and the $tax array. $tax the list of tids that you are interested in. The third element, named 'operator', can be and or or. So in your case, assuming the term ID for movies is '3' and the term ID admin/taxonomy/edit/term/3 for Anime is '6' admin/taxonomy/edit/term/6, you want:

// paste this code into a custom block of type=php
// customize the $tax array and the $subject as needed
$tax = array(3, 6);
$operator = "or";

$result = taxonomy_select_nodes($tax, $operator);
while ($obj = db_fetch_object($result)) {
  $node = node_load(array('nid' => $obj->nid));
  $items[] = l($node->title, "node/". $node->nid);
}
return theme('item_list', $items);

A Block that returns the first 5 terms for a taxonomy

$taxo_id = 3;
$sql = "SELECT node.title, node.nid FROM node INNER JOIN term_node ON node.nid = term_node.nid WHERE term_node.tid = $taxo_id LIMIT 5";
  $output .= "<ul>";
$result = db_query($sql);
while ($anode = db_fetch_object($result)) {
  $output .= "<li>".l($anode->title, "node/$anode->nid")."</li>";
}
  $output .= "</ul>";
return $output;

Taxonomy terms on a page

I have a page with a table where each cell should list nodes that are at the intersection of two keywords. In order to accomplish this I

Guide maintainers

jamespharaoh's picture