Community Documentation

Display (n) most recent nodes (including flexinodes) of certain taxonomy terms

Last updated January 8, 2007. Created by pwolanin on February 8, 2006.
Edited by puregin, ultimante. Log in to edit this page.

<?php
       
    $taxo_id
= "1,2,14"// The taxonomy term ID numbers
   
$list_no = 5; // Maximum number of posts to list
   
$sql = "SELECT DISTINCT(n.nid), node.title FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid in ($taxo_id) AND n.status = 1 ORDER BY n.created DESC ";
   
$result = db_query_range(db_rewrite_sql($sql), 0, $list_no);
   
$output = "";
    while (
$anode = db_fetch_object($result)) {
       
$output .= node_view(node_load($anode->nid), TRUE);
    }
    print
"<div class=\"link-container\">";
    print
$output;
    print
"</div>";
?>

About this page

Drupal version
Drupal 4.7.x

Reference

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here