By gabrielferreira on
I'm trying to put the last 5 specific type of nodes on the front page, but I'm having a problem with this code:
<?php
/* list of recent posts of node type 'page'
** output in descending chronological order
*/
unset ($output); // clear previous output
$node_type = "comentario";
$list_no = 5;
$sql = "SELECT node.title, node.type, node.nid FROM {node} WHERE node.type = '$node_type' AND node.status = 1 ORDER BY node.created DESC LIMIT $list_no";
$output .= "<h5><strong>Noticias</strong></h5>";
$output .= "<div></div>";
$output .= "<ul>";
$result = db_query($sql);
while ($anode = db_fetch_object($result)) {
$output .= "<p>";
$output .= "</p>";
}
$output .= "</ul>";
print $output;
?>
Comments
=-=
you may want to investigate the views.module to create this. If nothing else look at the query it produces.