The Webzine Drupal Module

Internet | Visual Design
This is a technical design document for the Webzine module for Drupal. It will be updated in an ongoing basis as I work with other Drupal developers.

The webzine layout is a new way to display the classic web layout style, common with web-based magazines and newspapers with roots a decade ago. An alternative to the familiar weblog format, it provides the following capabilities:

  1. Allows for layout of the dynamic content of the site into distinct sections, each of which may contain several links.
  2. Supports mixing headline-style links with excerpt-style links, based on the section.

The concept of “promotion” of stories has not been fully considered, but it should still work.

Further details have been given in the Webzine Format. Some readers have voiced complaints that this format makes it difficult for the reader to locate the “latest” story. The webzine format will still allow the familiar weblog format to be used. In addition, RSS is a recommended way to scan the latest stories/posts from multiple sites. Nonetheless, the webzine format should be beneficial to new and casual readers who want to scan many stories posted over a period of time.

Introduction: Node Types

In Drupal, the regular content is called a node and is stored in the table of the same name. Content is distinguished by the type field– page, story, book. Additional user-contributed modules specify types like event, survey, etc.

I’d like to propose coming up with additional set of types in place of story to indicate the section (or department) the content is in. These are very clearly not a subject-based classification, but more of an indicator of genre. See below.

I am not sure whether this approach fits in within Drupal’s plans. It might be preferable to simply prefix each type with a the primary type, like story_.

Database Table for Sections

This is a database table called sections. I have been thinking of these more as magazine departments rather than newspaper sections (which are quite often subject-based), but sections should work since we should think in terms of how to layout the content. Following is the layout used by this site:

Section Label Location Weight Style
pointer Links & Pointers AL 0 headline
thought Thoughts & Observations AL 1 headline
anecdote First Person AL 2 headline
question Questions For You AR 0 headline
proposal Ideas & Proposals BL 0 node
response Responses & Reviews BL 1 node
book Special Reports BR 0 node
analysis Analyses & Summaries BR 1 node
definition Definitions & Explanations BR 2 node

The location and the weight give a left-to-right, top-to-bottom layout. The first letter corresponds to a row; the second letter shall be L, M, R to indicate the column in that row. The weight, as elsewhere in Drupal, indicates the order within the block. The style indicates either node (the familiar display with an excerpt) or the headline (title only).

Civies Theme

The Civies theme is the reference implementation for the Civ media structure. It is Xtemplate-based. I’ve added an element for headline types:

<!-- BEGIN: headline -->
<div class="headline">
   <span class="author">{date}</span>
   <span class="title"><a href="{link}">{title}</a></span>
<!-- END: headline -->

For the traditional node style, it is highly recommended to trim the teasers to 700 characters (roughly 100 words) in order to fit as many on the cover page.

Xtemplate Engine Modifications

To get a head start, I thought I’d leverage the Xtemplate engine. But it required some modifications:

In xtemplate_node(), if we’re on the main page ($main > 0) we call webzine_coverstyle($node->type) to discern the layout style. This returns either node or headline from the sections table. If headline, it skips setting the title, picture, taxonomy, links. Also, I’ve changed the code at the close of this function to parse the appropriate element.


The webzine.module is the core functional block. It provides these functions:

webzine_help($section)  // standard help
webzine_menu($may_cache) // standard menu hook, calls page
webzine_page()  // calls webzine_render_nodes
webzine_render_nodes($result) // lays out stories by sections
webzine_coverstyle($type) // returns string

Other configurations

Lastly, we want to direct Druapl to run webzine instead of node as the default module, that is, when no menu is specified via the URL. This is simple to do on the configration page.

I’d also have to update the taxonomy module so that it calls our functions here. What I’ve done is replace taxonomy_render_nodes with webzine_render_nodes(). Ideally we need a factory function here to determine which *_render_nodes() to call.

It’s also necessary to mark the stories in the appropriate section as part of the content creation process. I expect to add a selectbox to the node/story entry form.

Project Status

This is being tested with 4.5.3. It should have no problem working with 4.6. I will be able to deploy it along with the initial ViewPoints release.