Hi

Loving all the new features in this module —especially the integration with echo module — makes email theming far easier than it ever used to be!

I have a question about templates however. Whilst having access to templates like the htmlmail—simplenews.tpl.php and htmlmail--user—password_reset.tpl.php is great , I think that they are too specific to be included in the module and will always need to be overridden in the theme. For example:

I want to provide a htmlmail.tpl.php in my theme to style all emails the same — with very specific markup to cater for my needs. However because htmlmail--user—password_reset.tpl.php is being provided in the module — and is a more specific template — it is always going to override my htmlmail.tpl.php in the theme for a password reset email. In order to get around this I need to provide a htmlmail--user—password_reset.tpl.php in my theme that is exactly the same as my htmlmail.tpl.php which is completely redundant.

Of course deleting the specific template files out of the module fixes the problem immediately but this isn't a good solution either because as soon as I upgrade the module I'm going to have to delete them again and if I forget then some very specific emails are going to break.

Is there perhaps another way to distribute example templates without having them included in the module?

Comments

pillarsdotnet’s picture

Version: 7.x-2.8 » 7.x-2.x-dev
Category: bug » feature

Well, you can always symlink your copy of htmlmail.tpl.php to htmlmail--user--password_reset.tpl.php (etc) in your theme folder, or use hook_theme().

pillarsdotnet’s picture

Status: Active » Postponed

Here's how it should work, but doesn't yet: If you create a template in your theme folder, then any more specific templates in the module folder are ignored. So if you copy htmlmail.tpl.php to your theme folder, then all templates in the module folder will be ignored. And if you create a htmlmail--user.tpl.php in your theme folder, then the module-provided htmlmail--user--password_reset.tpl.php will be ignored.

Probably this can be done by a re-ordering of the theme suggestions returmed by the htmlmail_theme() function. Take a look at it and see what you can do. On my personal to-do list, reviewing user-submitted patches comes way ahead of coding user-suggested features.

pillarsdotnet’s picture

Title: Templates too specific? » Templates in theme folder should override more specific templates in module folder.
P3t3r’s picture

Priority: Normal » Major

Any updates on this, after a year? It seems that this problem is still present in the current version. This is problematic since it seems that not overriding htmlmail--simplenews.tpl.php contages simplenews with the same issue (as it does work for simplenews with mimemail).

P3t3r’s picture

Err, ignore the above comment, it was caused by an issue in mailsystem on my side.

ashutoshjha’s picture

Version: 7.x-2.x-dev » 7.x-2.65
Priority: Major » Normal
Status: Postponed » Active

I am using simplenews, htmlmail, echo module to send newsletter with current theme. I am unable to receive themed layout in my mail. It only add some header section, body section and nothing more, I want to send complete themed layout with newsletter.

Thanks in advance!

P3t3r’s picture

Have you configured htmlmail and mailsystem to use your template (i.e. NOT 'current' or anything similar)?

ashutoshjha’s picture

Yes, i have configured both htmlmail and mailsystem. In htmlmail setting i have set a theme, and put the templates in theme folder. And in mail system i have enabled html mail system. But it doesn't works.

P3t3r’s picture

Have you cleared the cache? Can't think of much else. Here it worked flawlessly. Also, if you edit the tpl file from the module, does it work then?

BillyTom’s picture

Issue summary: View changes

I think it would be nice to have a template file that would be applied to all mails, regardless of override status.

The behaviour of the html.tpl.php and page.tpl.php in drupal-themes are a nice example. The html-file could contain all basic stylings for the email, including the header and footer. The page.tpl.php could contain specific stylings depending on the selected module/key of the email.

Right now I can emulate this behaviour by adding include('header.tpl.php') and include('footer.tpl.php') to every email-template, but it is kind of a messy solution.

salvis’s picture

Status: Active » Closed (outdated)