just the body of the latest nodes
Last modified: October 6, 2006 - 01:45
PLEASE NOTE! The following snippet is user submitted. Use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.
This snippet will display the full body from a specified number of the the most recent nodes of a specified type.
<?php
/* create only the body of the last node(s) specified by '$is_node_type' and '$list_nr'
* works with category module enabled in 4.7.2
*/
$is_node_type = "page";
$list_nr = 5;
$sql = "SELECT n.nid, n.vid, n.type, n.created, r.body, r.format FROM {node} n INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE n.type = '%s' ORDER BY n.created DESC";
$result = db_query_range(db_rewrite_sql($sql), $is_node_type, 0, $list_nr);
while ($node = db_fetch_object($result)) {
// print your markup here
print check_markup($node->body, $node->format, false);
}
?>