Drupal: How to Display List of Nodes Instead of Teasers on a Term Page
This article would tell you how to display list of all nodes of a specified taxonomy vocabulary dividing the list by node type.
We will use standard theming function to create a list:
$tid = 2;
$sql = “SELECT n.title, n.nid, nt.name AS type_name
FROM {node} AS n
INNER JOIN {node_type} AS nt USING (type)
INNER JOIN {term_node} AS tn USING (nid)
WHERE tn.tid=%d AND n.status = 1
ORDER BY nt.name DESC, n.created DESC”;
$result = db_query($sql, $tid);
while ($n = db_fetch_object($result)) {
$terms_links[$n->type_name][] = l($n->title, ‘node/’. $n->nid,
array(‘attributes’ => array(‘class’ => ‘vocabulary-list’)));
}
foreach ($terms_links as $type_name=>$nodes) {
$content .= theme(‘item_list’, $nodes, check_plain($type_name));
}
echo $content;