All content types _except_ forum posts
Place the following code in a block to display a list of all new content (newest on top) except forum posts. Posts do not move to the top when receiving replies, so each one appears on top of the list when created and when changed. The "More" link simply displays the "Recent posts" list (tracker) and can be omitted.
This is useful for example in combination with the Active Forum Topics block, so that forum posts are not displayed in both.
To adjust the number of posts shown, simply change the number at the second line (num_nodes = 5).
<?php
$num_nodes = 5;
$result = db_query_range(db_rewrite_sql('SELECT n.nid, n.title, n.type
FROM {node} n
WHERE n.status = 1 AND n.type <> "forum"
ORDER BY n.changed DESC'), 0, $num_nodes);
$output = node_title_list($result);
$output .= l('More...', 'tracker');
print $output;
?>
Works as Page or Story Block in Drupal 6
I hacked your code to make a Block of Stories and a Block of Pages.
Story Block
<?php
$num_nodes = 5;
$result = db_query_range(db_rewrite_sql('SELECT n.nid, n.title, n.type
FROM {node} n
WHERE n.status = 1 AND n.type = "story"
ORDER BY n.changed DESC'), 0, $num_nodes);
$output = node_title_list($result);
print $output;
?>
Yes, this is only the five most recent stories, but it works for now.
Page Block
<?php
$num_nodes = 10;
$result = db_query_range(db_rewrite_sql('SELECT n.nid, n.title, n.type
FROM {node} n
WHERE n.status = 1 AND n.type = "page"
ORDER BY n.changed DESC'), 0, $num_nodes);
$output = node_title_list($result);
print $output;
?>
This is assuming there aren't more than 10 pages.
Indeed these are some ugly hacks. I was unable to find a solution to display a Block of all content type Page (or Story or both). I do not know php to write my own.
DanielTheViking, thanks for posting the original php snippet.