Tailoring Drupal to fit as a newspaper CMS
As mentioned earlier I was looking for a CMS to publish a newspaper. This is: Make the printed content available online and allow additional online publishing. Since I couldn’t find an appropriate system to do this out of the box, I finally decided to take Drupal and customize it to fit my needs. Here's why and how.
First I'd like to take a look at the requirements. The newspaper, a student's magazine actually, is published monthly and done using Quark XPress. Currently, the online content is created by
- Exporting all articles from Quark XPress using the so-called XPress-Tags. XPress-Tags is a plain text format that contains both font and paragraph related formatting commands.
- The files are processed using an application I wrote back in 2000 and converted into XML.
- From the XML, information about authors and volume is extracted and stored.
- Using XSLT, the XML is transformed into HTML and overview pages like the archive are rebuild.
- Generated files are uploaded to the web server.
This results in this pages.
The content - this is: an article - generally consists of:
- A heading
- A subheading (optional)
- A preface (optional)
- The text body
- One ore more authors
- A footnote containing for example titles of reviewed books (optional)
Also, a text can have special paragraph formatting. Questions within an interview for example are formatted in italic.
The website should allow the user to navigate the content
- By volume
- By author
- By category
- By search
Last not least, the CMS should be written using PHP and MySQL, since LAMP webspace is cheap. It should be free and open source to be customizable.
While it was pretty clear, that importing XPress-files had to be coded by hand, I figured out that virtually no existing CMS was able to fullfill the rest of the requirements to a reasonable extend or offers plugins to do this. For example no CMS I tested (thanks to the famous site Open Source CMS!) distincts between the author of content and the publisher. Instead, these two roles commonly are regarded as beeing the same and usually fullfilled by an authentificated user.
At this point, I decided to write the thing myself. I had a look at some CMS and started to investigate them from a programmers point of view. Finally, I got stuck with Drupal, for several reasons:
- Custom content types can be provided (a newspaper article)
- Custom input filters can be written (reading XPress Tags)
- Custom tpyes can be introduced (authors, volumes)
- It offers a neat translation interface (page is in German, but code should be in English)
- The PHPTemplate engine offers a high degree of adapting templates to special needs (rendering the articles)
- It has a good and structured API documentation
Drupal also has some drawbacks, namely it's understanding of "clean URL" ("/node/1" is NOT what I call a clean URL) and a rather poor category management. However, these limitations can be bypassed using according modules/plugins.
Starting to write my own module, I first introduced a new content type called "newspaper article", which offers all the requiered fields. From the user input I extract the authors and store them in a separate table. Next step was to extend to Dupal administration menu with commands to edit authors and to introduce mechanisms to display a single author's page containing all his or her articles and a page that lists all authors.
I then wrote a custom input filter to translate XPress Tags into XHTML using the available paragraph format to assign CSS classes. For example "@T_IF:" is turned into "<p class="interview-question">". Char formatting is converted. XPress Tags supports tags similar to HTML ("<b>" or "<i>"), but doesn't know closing tags. Instead it has a "reset all" command ("< $>") and additional switches unknown to HTML (e.g. "<k>" for defining kerning).
To link articles to volumes I tried to rely on the taxonomy modules, which offers categories. However, I figured out that this is inapprobiate, since there's to little control over how categories are handled. Also, the taxonomy turned out to be overcomplex to the required task.
I therefore extended my module by adding a representation for a volume, wrote the according administration and display routines and additionally turned all article URL into "/volume/number/title_of_article".
While my code now is feature complete, I need some time to test and polish. Within a few weeks, it will be online. Some time after that, I will publish it for download.
To summarize, the task turned out to be rather easy to fullfill, though it sounded like a bunch of work at the beginning. Thanks to the Drupal API, which for my taste is very intuitive, the excellent documentation and handbooks, and all the Drupal module developers: I learned a lot examining your code.
Comment by Ryan
October 27, 2005 - 21:30
Hi,
Just finished reading your post. As i'm investigating Drupal for several projects, I was just a little curious about something. Did you try asking in the forums about how other people have accomplished this? For example, I know there are several other news type sites available - TheOnion for example uses Drupal. It also seems like several of the features you mentioned having to code by hand might actually have existing solutions that just might require thinking about the issue from a different perspective. Anyways, its great that you got what you needed I was just curious.