(Tips) Creating an HTML newsletter
Tips : Creating an HTML newsletter
We recently remade our company newsletter from a simple plain text affair to a simple, but elegant HTML newsletter. The first attempt at this utilized a combination of the Simplenews and Mimemail modules. This, however, didn't work as expected, so we went with a partially custom solution.
The Simplenews module is still at the heart of our new newsletter, but a few custom tweaks (no hacking of the original module, of course) were added to make things simpler on Thomas when he creates these.
The first addition, was a preview button to view the newsletter using the themed HTML template (the one used to actually mail the newsletter, rather than the node template for viewing on the site). This was a simple matter of altering the newsletter node form, and adding a callback to compile the preview.
/**
* Implementation of hook_form_alter().
*
* Add a preview email functionality.
*/
function os_newsletter_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
case 'simplenews_node_form':
$form['buttons']['preview_newsletter'] = array(
'#type' => 'submit',
'#value' => t('Preview Email Format'),
'#submit' => array('os_newsletter_build_preview'),
'#weight' => 15,
);
break;
}
}This adds a third (or fourth, for edits) button to the node form for previewing.
| Read more..
Courtesy : Opensourcery.com
- guru's blog
- Login to post comments
![Drupal-6-Book-[Building Powerful and Robust Websites with Drupal 6].jpg](http://www.drupalranch.com/images/Drupal-6-Book-[Building%20Powerful%20and%20Robust%20Websites%20with%20Drupal%206].jpg)