Simplenews theming and snippets
Newsletter theming
You can customize the theming of newsletters. Copy any of the *.tpl.php files from the simplenews module directory to your theme directory. Both general and by-newsletter theming can be performed.
Theme newsletter body
* simplenews-newsletter-body.tpl.php (for all newsletters)
* simplenews-newsletter-body--[tid].tpl.php (for newsletter series tid;
where [tid] is replaced by the term id of the newsletter taxonomy term.
Theme newsletter footer
* simplenews-newsletter-footer.tpl.php (for all newsletters)
* simplenews-newsletter-footer--[tid].tpl.php (for newsletter series tid)
The files are self documented listing all available variables.
Using the Display fields settings each field of a simplenews newsletter can be displayed or hidden in plain text and/or HTML newsletters. You find these settings at: admin/content/node-type/my-node-type/display
CSS in HTML newsletter
Although simplenews does not support HTML newsletters on its own, this tip is worth mentioning: Place your CSS inside the HTML <body> tag as described here.
Simplenews code snippets
A single subscription block for all newsletters
Create a custom block with this php code:
<?php
print drupal_get_form('simplenews_subscription_manager_form');
?>
Clear the cache
Remember to clear the cache data and rebuild theme registry by visiting ...?q=admin/settings/performance and pressing the button, otherwise the .tpl.php file in your theme folder will not be taken into account...
XP-Internet.com
I cleared the cache and tried
I cleared the cache and tried that snippet above (to creat a single subsription block) and get this error:
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'simplenews_subscription_manager_form' was given in /home/dowsett/public_html/hangon/includes/form.inc on line 366.I have exactly the same
I have exactly the same problem.
I found out somewhere in the site that we should use module_load_include() to include simplenews.subscription.inc.
But how do we do that? Is there any solution to the problem?
thanks
it's work !!!
Try this one
<?print drupal_get_form('_simplenews_subscription_manager_form');
?>
Sorry, this code just create new block with subscription form but it doesn’t work :(
This code works for me
<?phpmodule_load_include('inc', 'simplenews', 'simplenews.subscription');
print drupal_get_form('simplenews_subscription_manager_form');
?>
I put it in a custom block and it works just like the subscription page
Kewedia Solutions Co. - innovative media design service and website service provider from Hong Kong
Where to put simplenews-newsletter-body.tpl.php? gotcha
simplenews-newsletter-body.tpl.php and simplenews-newsletter-footer.tpl.php need to go into whatever theme you have selected as the administration theme, because this is the theme referenced when the email is sent.
This is obvious now in retrospect. But it was not the first few test emails when I was wondering why the .tpl file in my presentation them were not being recognized. D'oh!
Formatting sent html newsletters with css
This is more of a mime mail thing I suppose but this is handy information for newsletter theming.
To format the sent newsletter with css you will need to create a mail.css file and put it in whatever theme you use as your admin theme (in my case it is garland). I edited the garland.info file so that it recognizes the new mail.css file, adding this line:
stylesheets[print][] = mail.cssThe good news is that the mimemail_compress module that is included with the mimemail module does an impressive job of taking the styles that you have created in the mail.css file and writing them as inline styles in the sent email.
It appears to me to works as good as this functionality in Campaign Monitor.
My email newsletters so far have displayed really well in Gmail, Mac's Mail application and Microsoft's Outlook Express.
I am quite impressed with the new Simple News module and family of modules. It has improved dramatically and will only get better. Thanks to the developers
Images in the newsletter have ro have absolute urls.
This code works for me
<?phpmodule_load_include('inc', 'simplenews', 'simplenews.subscription');
print drupal_get_form('simplenews_subscription_manager_form');
?>
I put it in a custom block and it works just like the subscription page
this one is for 6.x, i'm not sure if it's working in all situations.
so if anyone please help test it out, and if it works, then update this page?
Kewedia Solutions Co. - innovative media design service and website service provider from Hong Kong
theming
Hi,
how to theme the form "simplenews_subscription_manager_form". I'd like to add Image buttons for the different buttons.
I'm new with drupal an tried to use the function:
mythemename_simplenews_subscription_manager_form ($form) {
}
in the template.php file to alter the form. But nothing happen.
Thanks a lot for your help.
Philip