I am trying to create a simplenews newsletter, also using Simplenews Scheduler, to weekly send out a newsletter with the content defined by views.
I have a content type set up, and the views defined. I have the views inserted into the content type using Viewfield. This all works fine and the email sends with the views content. However, the styling is not correct.
My views return lists of full nodes which I have set the View Mode of as "Email: HTML". Within the templates in my theme I have added the mark-up I want for the node with that View Mode. When viewing the newsletter on the site (as a node) it all looks correct. However, when I send the newsletter, the email I receive has the view in it's raw format (like that which is displayed in the view preview) and has none of the mark-up I've specified.
How can I get the correct mark-up showing? I don't know if I'm just missing a setting somewhere or something.
Many thanks.
My newsletter template (simplenews-newsletter-body--13--email-html.tpl.php) is as follows:
<?php /*This appears in the email*/ ?>
TEST NEWSLETTER TEMPLATE
<div>
<?php /*The following should print the full newsletter node including the views*/ ?>
<?php print render($build); ?>
</div>
<div>
<?php /*The following should print a single view*/ ?>
<?php print views_embed_view('news_upcoming_events','block_1'); ?>
</div>
The event node template (node--event.tpl.php) which is returned in the view used in the newsletter template:
<?php if($view_mode == 'email_html'){ ?>
TEST EMAIL TEMPLATE
<div>
<h3><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h3>
<div><?php print render($body); ?></div>
</div>
<?php }else{ ?>
NORMAL VIEW
<?php } ?>
The newsletter template all appears fine in the email. I see the line TEST NEWSLETTER TEMPLATE
, but the event node templates are not used in the views output. It is instead some generic drupal/views output.
This is the way the view is setup.
And this is the preview displayed with in the view setup. This is also what is appearing in the email when the newsletter is sent, instead of the mark-up declared in my template file. (It is correct when viewing the node on the website though)