You are hereHome / Drupal / Tailoring Drupal to fit as a newspaper CMS

Tailoring Drupal to fit as a newspaper CMS


By Gerd Riesselmann - Posted on 11 October 2005

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.

Tags

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.

Hello Ryan,

I was browsing the modules repository and also googling a bit but found nothing. I was experimenting with some existing drupal modules, namely a combination of flexitype, e-publishing and taxonomy but found them to be to abstract to serve my concrete needs.

For example, when quitting with flexinode and introducing my own newspaper article node type, I still relayed on taxonomy for volumes. However, it turns out that for example displaying a list of all articles within a volume in the correct order (this is in this case from page 1 top to page 16 bottom) was quite difficult. Introducing a distinct volume type then made things a lot clearer and more easy.

So finally one step followed the other, although - since I'm a programmer - at some points I may have been biased ;-).

Taxonomy is very flexible for tagging content with attributes, but that's also led ltos of developers to shoehorn hierarchial relationship management into taxonomy's mold. It's tempting, but I've come to the same conclusion that both of you have -- distinct issues and volumes, as with a newspaper or what not, really do demand a dedicated relationship system.

Hi Nikola,

I tried Props, but - well - couldn't get it to work. I therefore ranted about it a while ago ;-).

The Drupal module currently is in testing phase. The next step to do right now is getting the old content into Drupal, which is rather simple, but since I'm also rather busy at the moment, this still may take some time.

The philtrat site you visited indeed has no images, since it was generated out of plain text files. This is not the Drupal powered version, though, which may or may not have images. Depends on how much time people are willing to spend on uploading the printed content, actually.

The review was quite comprehensive and includes a lot of information. I think this deserves to be read by all web developers. As a developer myself there are several issues that I have to deal with in making websites. I am a type of developers who puts emphasis on images than the content. In this case Drupal comes into the picture.

Gerd-
I'm in the same spot you were in a few months ago. Just curious what progress you've made with the drupal module, and if I could see the code and maybe help out.

I'd also be interested in seeing how you did the XSLT / XML shift.

Thanks for any help! (btw, the current incarnation of my newspaper's site is not my work at all. they're bringing me on to replace it in january)

-Matt

Hi Gerd,
I just stumbled upon the ePublish Drupal module.

http://drupal.org/project/epublish

Have you tried it?

Chris

Yes, I tried it, but somehow it didn't fit into my mindset. And it didn't solved my main problem: Keeping author and publisher divided.

This sounds so exciting. We're trying to make drupal our newspaper cms. Have you published your code?

Hello.
I'm facing exactly same issue, as you have covered here. Are you still working on it?

Hey, this is an awesome resource to stumble on. I am busy with exactly the same project and haven't been able to find an appropriate package. I'm building it on Wordpress because I am very comfortable with it, although I know that the workflows in it suck. But it has awesome external party integration (specifically Flickr) that I'm using. The theme K2 is also very powerful when it comes to having specific layouts for pages and posts.

I'd really like to bounce some ideas around with you, would you drop me a comment or skype/gtalk? I have a much bigger plan in mind than just a once-off publishing system. You can check out the student site we're busy with here: http://www.diematie.co.za

Topics