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

Comments

mkpaul’s picture

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

  $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++;
  }