Simplenews theming in Drupal 7

Posted on April 3, 2012

0


Drupal 7’s best newsletter system Simplenews may not be true to its name. Finding right files to edit for making a custom look for your newsletters has some questionable logics.

Comparing Simplenews in Drupal 6 to Simplenews in Drupal 7, quite some things has changed in the name of keeping things logical. That means that in 7, you have to open People settings to find subscribers, Configuration page to change Simplenews options and Structure options to change the looks of your letter. That is all ok, except if you have previous experience from Drupal 6 where all Simplenews-related tasks were pretty much in same place.

This is not really a difficulty, more like a matter of getting used to it. Real frustrations might rise when you are trying to edit Simplenews template files to customize the looks.

First of all, it’s important to realize there are two different sets of templates for Simplenews. One is for sent letters and another is for viewing the letter online as part of normal Drupal content (I mean, as a node). Lets see the latter first.

Following Simplenews documentation you can place files called simplenews-newsletter-body.tpl.php and simplenews-newsletter-footer.tpl.php in the folder of your theme. So if your theme is a custom theme called orange, you would copy these files from Simplenews module folder to /sites/default/themes/orange/simplenews-newsletter-body.tpl.php and /sites/default/themes/orange/simplenews-newsletter-footer.tpl.php. Editing these files changes how the newsletter will look as Drupal node. Remember to empty caches when adding new files.

For many, the looks of the node of the newsletter is secondary. Most important thing is to make it look right in recipients email box. To do that, you have to use same body and footer files as before but place them inside your sites administration theme folder. This makes little sense, but when you know it, it is just a minor annoyance. Most of the setups will use Seven for Drupal 7’s default administration theme. So, from Simplenews module folder, copy these files in place: /themes/seven/simplenews-newsletter-body.tpl.php and /themes/seven/simplenews-newsletter-footer.tpl.php.

As a general rule, you should write newsletter template in HTML3. Yes you got that right, using technology from 90’s is required by most of the Outlook email clients still in use. In short, it means using tables a lot and limiting template width to 600 pixels. Strangely enough, inline CSS rules are working in older Outlooks just perfect.

Advertisements