List of node titles in a vocabulary or taxonomy term

mkpaul - November 27, 2004 - 00:19

Hi,
I am planning to use drupal for my website. But so far i was not able to find a way to list latest posts by taxonomy term. If i use latest.module found in the forum, it lists all latest posts from all categories. What i am looking for is latest article titles in each category.

For eg.

veg -- vocabulary
carrot -- term
potato -- term

meat -- vocabulary
chicken -- term
beef -- term

In the above case, is it possible to list all the latest posts in veg only? Is there a standard module for that?
Any hacks?

thanks,
Paul

Partially solved

mkpaul - November 28, 2004 - 04:33

hi,
Created some code to get the listing. It works perfectly on my local machine, but when uploaded to website, it is brocken.... I have no idea what is going wrong. can anyone help?

Paul

Code to list latest titles, categorised by vocabulary

<?php
  $vocabularies
= taxonomy_dhtml_get_vocabularies();
 
$i=0;
  foreach (
$vocabularies as $vocabulary) {
     
$out .= $vocabulary->name;

   
$result = db_query_range("SELECT tid, name FROM {term_data} WHERE vid = '". $vocabulary->vid. "'", 0, 3);
    while (
$term = db_fetch_object($result)) {
     
$tids[] = $term->tid;
     
$names[] = $term->name;
     
$out .=  taxonomy_context_show_nodes($term->tid);
    }
      print
$out;
      unset(
$output, $tids, $names, $out);
     
$i++;
  }
?>

 
 

Drupal is a registered trademark of Dries Buytaert.