Community & Support

How do I list every node of a certain type?

I'd like to have a page

site/drupal/announcements

On that page, it lists the 10 most recently created nodes from type 'announce'

Is there a module that will help me with this?

I tried creating a block, but the following line code keeps blowing up on me:

while($sql = db_query("SELECT nid FROM {node} WHERE type = 'announce' ORDER BY created DESC LIMIT 10")) {

That is just a snippet, but I identified that as the line causing the problems. The line works fine when I put it in phpmyadmin.

Any help would be a great. A simple module that does this would be perfect, honestly.

Comments

The views module make this

The views module make this easy, you can create both page and blocks views for listing nodes filtered in a number of ways including content type.

If you want "simple", there

If you want "simple", there are:
http://drupal.org/project/get_content_type for creating lists of nodes by content type
http://drupal.org/project/node_type_filter for getting only a content type from an existing list.

The http://drupal.org/project/views module is not as simple as those, but if you learn it you can list almost anything in any way.