Simplenews,
creating news letters using
views and node queue

Following the recent earthquake in Haiti a plea was put out by the administrator of a website for a orphanage/school in Port-au-Prince for some help with their news letter.

The brief was that they wanted to generate newsletters from existing content whilst keeping a record/archive of previous news letters.

Modules used

NodeQueue was used as the means of selecting which content was to be distributed in the next newsletter. When you install NodeQueue you can associate it with certain content types, then when viewing posts of that content type you are offered a link to add that post to the NodeQueue.

Views Each NodeQueue has a view associated with it, in which you can define fields etc. You can display this view as a page, block, feed etc but for this instance we just needed it to format the selected content ready to insert as a static version into a newsletter.

SimpleNews and CCK SimpleNews is dependant on CCK, when you enable SimpleNews a content type 'newsletter' is created. Also a taxonomy vocab is created allowing you to have many categories of newsletter.

To get the information from the view to the newsletter you could just display a block of the view in the content area. This would provide the right content for the emailed newsletter but as the content of the block would be dynamic there was no way to provide an online archive of newsletters. Everytime you adjusted the NodeQueue the view block is updated too.

The solution was to provide default content to the content type 'newsletter' every time a new newsletter was created.

You can't add a default value to the standard body field, so that was disabled and a replacement text area field was added using CCK.

When you add a new CCK field you are presented with options depending on the type of CCK field. The text field allows you to use php code to generate a default value for your field.

Adding the following code fetched the full html output of the view created earlier and inserts it into your text area.

  1. $viewName = 'nodequeue_1'; // nodequeue_1 = name of view I want added.
  2.  
  3. return array(
  4. 0 => array('value' => views_embed_view($viewName)),
  5. );

So almost there, try it out. You'll see that if you add some posts to your NodeQueue and then create a new newsletter those post (or fields you have selected in your view config) will be added to your newslatter.

The only thing left is some theming, you'll notice that the view edit/export/clone links have been added too. You can rid yourself of these by creating a template file for views-view--nodequeue.tpl.php and removing the reference to these links.

ralph lauren

nakyarwxbrktdfqpluwf, http://www.mynewpolo.com/ ralph lauren, IjnBbIF.

Very useful tip! Thanks

I quoted it on drupal.org, hope you don't mind:
http://drupal.org/node/812550#comment-3050556

jordipn sxifgnb

avjxswcmneznayktxwsy, http://www.whknfmczro.com qqixmmpokc

nfpxjfl bvpuwow

ioejusrxodxxqkvgcgff, http://www.fpvvidpsgi.com xswokabdwu