By huss on
I can't list only stories or only pages.
I tried using "page" or "story" as a path in the menus but it didn't work.
I think there is an easy way to list all types of content in the same way you can list blog entries by typing "blog" in the path field for the menu item. But i can't find these default paths. Any help will be appreciated!
Comments
I think you need to get hold
I think you need to get hold of the excellent Views module!
--
Ixis (UK) providing Drupal consultancy and Drupal theme design.
--
Ixis (UK): Drupal support, Drupal hosting.
Well..
It does work for blog, but that's part of the blog module (see blog_menu for the path setting and blog_page for its callback function) whereas story.module and page.module have no such functions.
What you can do is a custom page that lists them by creating a page, setting its input type to PHP and using a variation of the following code:
This should list the last 5 created pages for you. You can fiddle with the 'LIMIT 0, 5' portion to increase how many are displayed, or take it out to show them all. Change type 'page' to 'story' for stories. Also, you can change what output is displayed.
Using the functions node_load and node_view you can list teasers instead of the title.
That should work.. may need some tweaking.
Insecure snippet
The first snippet is insecure:
It bypasses node access restrictions
It doesn't check user supplied data on output.
See http://drupal.org/node/62304
--
The Manual | Troubleshooting FAQ | Tips for posting | Make Backups! | Consider creating a Test site.
My bust, I just copied that
My bust, I just copied that from code I use on a site where I don't bother w/ restrictions since I'm the admin. = P
arriving late to the party, but
While Heine is fundamentally correct that your snippet doesn't conform to Drupal secure code standards, in this case the risk is minimal because no user-supplied data is being passed.
node_type_filter
A simple solution is to install the tiny node_type_filter module.
Then you can append ?type=story, for example, to various paths, to filter the content.
FYI There is an option for
FYI There is an option for this (Filter by node type) in (at least) the current version of Views for Drupal 5.x (I have Views version 5.x-1.6).