Three More Newspapers Migrating to Drupal

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
DartonW's picture

Hi all,

I'm leading the conversion of three NC newspapers to Drupal 6, the first of which is The Daily Reflector. With our first big Drupal 5 site completed (to be upgraded to D6 soon) and many lessons learned, I figured it was time to start contributing back in the form of writeups and possible modules with this project.

Comments and criticisms are welcome, and this is just the beginning. I will continue to update this post as I have time and will create a full case study when the project is completed.

Our development server is at http://reflector.cookecomm.net. We are importing NITF from a DTI publishing system via XML-RPC and node.save with the services module, along with many of the standard modules listed at http://groups.drupal.org/node/5281.

For the XML-RPC client (example at http://groups.drupal.org/node/27482), our goal from the beginning was to implement it in PHP so that it could be converted to a module later on. We are currently running it as a very bare-bones module (enable/disable only) implementing hook_cron. This could usefully be extended to store its settings in the database, get settings from Drupal, and automatically synchronize content bidirectionally with remote systems. We are looking at other modules to extend or integrate with such as http://drupal.org/project/importexportapi and http://drupal.org/project/nitf_views. We store any useful metadata from the NITF as custom CCK fields, using the metadata as filters for Views.

Using Panels 2, the home page is (experimentally) created with a "Flexible panel" layout to allow less technical users to organize content. Views are further re-used on multiple pages and in multiple panels with different displays, enabled by the integration of those two modules. The design and layout of the existing site are completely re-implemented using a CSS layout based on the NewsFlash theme. The menus are only slightly modified from the default Suckerfish menus included with NewsFlash. Reusing the old design was intended to save some time, but re-implementing it while trying to comply with even XHTML-transitional has been quite a challenge. We're not even close yet, but I've found that markup validity is inevitably compromised by the realities of dynamic, consumer-controlled content and advertising as soon as the site launches. We strive for it all the same.

We have created a custom layout for node pages by adding a new directory to modules/panels/plugins/layouts with the appropriate files. I'll list those here because I've seen a few posts wondering how to do this.

custom.inc

<?php
// $Id: cooke_custom.inc,v 1.0 2009/10/16 21:27:58 dkw Exp $


/**
* Implementation of hook_panels_layouts().
*/
function panels_cooke_custom_panels_layouts() {
  $items['cooke_custom'] = array(
    'title' => t('Custom Node Panel'),
    'icon' => 'custom.png',
    'theme' => 'custom',
    'css' => 'custom.css',
    'panels' => array(
      'header' => t('Header'),
      'left' => t('Left rail'),
      'middle' => t('Middle column'),
      'right' => t('Right rail'),
      'footer' => t('Footer')
    ),
  );

  return $items;
}

custom.tpl.php

<?php
// $Id: cooke-custom.tpl.php,v 1.0 2009/10/16 21:27:58 dkw Exp $
/**
* @file
* Template for a 3 column panel layout.
*
* This template provides a custom three column panel display layout, with
* additional areas for the header and footer.
*
* Variables:
* - $content: An array of content, each item in the array is keyed to one
*   panel of the layout. This layout supports the following sections:
*   - $content['header']: Content in the top row.
*   - $content['left']: Content in the left rail.
*   - $content['middle']: Content in the middle column.
*   - $content['right']: Content in the right rail.
*   - $content['footer']: Content in the footer.
*/
?>


<div class="panel-display cc-panel clear-block">
  <div id="cc-panel-header">
    <div class="inside"><?php print $content['header']; ?></div>
  </div>
  <div id="cc-panel-container">
    <div id="cc-panel-left" class="cc-node-column">
      <div class="inside"><?php print $content['left']; ?></div>
    </div>
    <div id="cc-panel-center" class="cc-node-column">
      <div class="inside"><?php print $content['middle']; ?></div>
    </div>
    <div id="cc-panel-right" class="cc-node-column">
      <div class="inside"><?php print $content['right']; ?></div>
    </div>
  </div>
  <div id="cc-panel-footer">
    <div class="inside"><?php print $content['footer']; ?></div>
  </div>
</div>

custom.css

/* $Id: cooke_custom.css,v 1.0 2009/10/16 21:27:58 dkw Exp $ */

#cc-panel-container {
}

#cc-panel-container .cc-node-column {
  float: left;
}

#cc-panel-left {
  width: 200px;
}

#cc-panel-center {
  width: 400px;
}

#cc-panel-right {
  width: 336px;
}

#cc-panel-footer {
  clear: both;
}

Side note: We're using XCache for a performance boost, as it has served us quite well in the past. The development server is a FreeBSD 7 virtual machine running several Drupal sites, MySQL and Apache, on only 512 MB of memory.

That's it for now, got some more coding to do.

Comments

Thanks

yelvington's picture

Darton, thanks for the explanation, and please do update it as you go.

I have a couple of questions:

  • What made you choose the XML-RPC posting method rather than processing a feed?

  • What do you plan to do about images?

  • Is your DTI feed as unpredictable as ours? :-)

Your method of using xpath rather than a validating parser is interesting.

Newspapers

DartonW's picture

Hi Steve,

We used XML-RPC to enable the customer to send XML to the server or process files from their end. Plus, we ended up having to do a ton of validation, transformation (Tidy to clean up the often malformed XML, ASCII transliteration, etc.) and regex replacements before importing the content. The script I posted has been through quite a few revisions to account for specific errors we encountered.

Images we handled in a couple of ways, I'm sure everyone is familiar with the common difficulties encountered in this area:

Since the images are imported from <media> tags in the NITF, we import the story node first, get the nid back from the services call, and set the Related Story field on the image to the parent story's nid. This field is then used as an argument for Featured Story views and to display images in the left rail on story node pages such as http://reflector.cookecomm.net/content/school-board-discuss-school-assignments-11310. We came up with this custom solution because it didn't require any extra modules and is very simple to use with arguments.

We are using ImageCache to display them; the import script simply copies the images to the site's files/images directory for that part. With a bit of Apache mod_alias magic, we gave them friendly URLs such as http://reflector.cookecomm.net/assets/featured/GrowSmallerHighSchools.jpg. We then create a node with some CCK fields for related story, caption and credit and an image tag for the body. This gives us a node like http://reflector.cookecomm.net/content/growsmallerhighschoolsjpg-11313, but we don't really use this node for much. Most of the work is done by views, some of which are implemented as custom templates with another view for the image embedded.

And yes, the DTI feed is wonky ;).

Cool

TheTrib's picture

I look forward to more posts and write-ups on how you are handling this transition. We are going to be using Drupal 6 for our paper CMS too and love to read posts and compare what other papers are doing. I have read APC is the best php cache for drupal but do what works is my motto. 2 bit articles have helped me enormously for server tweakage.

http://2bits.com/articles/drupal-performance-tuning-and-optimization-for...

Cheers and keep up the good work.

Launched Another Site With Drupal

arnieswap's picture

In addition to Kalkions, just released the Beta of Business Technology news site Katonda.com. Powered by D6.

http://katonda.com/

Would request a look :-) Willing to share any info regarding setting it up.

Swapnil

Newspapers on Drupal

Group organizers

Group categories

Topics - Newspaper on Drupal

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week