Why is everything so hard?

Published June 11, 2007
Advertisement
This is work related. I'm working on testing out a popular content management system for an interactive web site: Drupal 5.1. It's a reasonably well functioning system, with a rich feature set, and it installs easily.

Among the features is the ability to add a new kind of content. You start out with "Page" and "Story" content types, and can add more using a simple web based interface. So I added the "Document" content type to host file uploads (Drupal already supports allowing file uploads for defined content types). Defining the content type is easy! I can also add a content of a specific type, and even find it in the search function.

However, I now want to create a menu item called "Documents" which lists all file uploads. Should be simple, right?

Wrong.

Drupal comes with no such feature, and searching the online documentation on "filter node type" and other such variants, I'm still nowhere near a solution. Then I find a user-contributed snippet, of how to display all content EXCEPT for a given type -- aha! I'll just change the "<> type" to "= type" and I'm done!

Except the formatting is really bland, so I need to dive in to figure out how to add annotation such as "submitted by ". Most of it was easy to figure out by reading source, but I got stuck for almost an hour on how to properly format a date to the user's preferred format using the Drupal settings (the answer is the 'format_date' function).

The problem really wasn't that it was hard; the problem was that the documentation was pretty sparse, and worse, there was no useful search function. Even a Google search with site:api.drupal.org returned nothing useful and lots of chaff.

Well, that, and I can't believe nobody before me have actually wanted a page that lists contents of a given type that they've just defined.
Previous Entry Writing and Building
Next Entry Screenies
0 likes 1 comments

Comments

danien
For listing all content of a particular node type, check out the Views module (http://drupal.org/project/views). This allows you to select a node type, filters, sort order, etc.

For displaying "Submitted by blah on date", go to Admin / Themes / Configure (the one at the top for Global Settings, not the Configure for a particular theme). In the "Display post information on" block, make sure the node type you want is checked.

If you want deeper customization of the look than Theme allows, you'll have to dig into the phptemplate system that Drupal uses. This lets you create html template files with PHP code to get the variables that Drupal exposes so you can customize the look in greater detail.

Good luck!
August 04, 2007 02:53 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement