The Firedrop ItemList content type

ItemList

The ItemList content type can be used to group various nodes together on pages, in a certain order. If that sounds vague, think of a FAQ; however, ItemList can be used for other things as well.

On each page, a number of nodes will be displayed, much like in a Weblog:

1. What is Firedrop?

Firedrop is blah blah...

2. Where can I download it?

...text here...

3. How do I create a site?

...text here...

And so on. Unlike Weblogs, however, an ItemList page is created by taking nodes in a certain category, then ordering them by the order attribute. For example:

insert_date='2004-02-12 22:26:00'
modified_date='2004-02-12 22:28:33'
order=1
page='firedrop'
--
What is Firedrop?
blah blah

The page attribute represents the category. The category must be present in the site's categories list, or the node will not appear anywhere.

The order attribute is used when sorting the nodes in a category. Note that this is not necessarily the same as the number the node will eventually have. They *may* be the same, if you consistently number your nodes 1, 2, 3, etc. Nodes without an order attribute are considered to have a value of 999999999, so they will usually appear at the end. Orders should be numbers and not strings or anything else.

Templates

The ItemList object has a special method, make_list_html, that can be used to generate a HTML list with links to the nodes. This is useful at the top of a page, serving as an "introduction" and as a way to get to items quickly. Use it like this:

<% publisher.make_list_html(current_entries) %>

Both publisher and current_entries are special variables that are only available for ItemList. Using them for other purposes is not recommended.

A sample entry template, that displays the item's number, may look like this:

<p>
<a name="<% entry_number %>"></a>
<h3><% entry_number %>. <% entry.title %></h3>
<% entry_body %>
</p>

entry_number is a special variable that display's the item's number (which is, again, not the same as the order). Also note that the numbers are optional. They make sense for FAQ items, which usually have numbers, but can be omitted if necessary, simply by editing the entry template.

Separate pages

Normally, most nodes will belong to a category, and thus their content will show up on a category page. However, it is also possible to create a separate page (much like in an ArticleCollection). This is useful for creating an index page with links to the category pages, for example.

You can make a separate page by setting an entry's pagename attribute. This will exclude that entry from any categories, and publish it on its own page.

To make matters easier, a default node for an index page is generated when you create a site of type ItemList.