Jump to content

Include footer.html code in email templates as php include not supported


Recommended Posts

Hi,

 

I am trying to include a html file (my email footer) into my html email templates. However, php include functions would now work in those files.

 

Any way to solve that? I would not want to maintain x number of email footers and other recurring components...

 

Thanks!

Link to comment
Share on other sites

Hi Vekia,

 

unfortunately not. I have a few recurring texts (thank you note, questions disclaimer, legal disclaimer, corporate address, etc.) which I would like to place in emails at different placed. My goal is to only have 1 html file each to maintain the source, but the flexibility to include / exclude and shuffle the same info in the email templates.

 

Maybe there is a way to enable a php include within the html templates?

 

Any suggestions highly appreciated!

Link to comment
Share on other sites

  • 1 month later...

Hi Daniel,

 

unfortunately, I wasn't able to find a solution to include a common code - I settled with maintaining all emails separately. I standardized the layout of the code, so I would be able to quickly find and replace the footer code.

 

Greetings,

 

Sebastian

Link to comment
Share on other sites

  • 2 weeks later...
I think you maybe can modify the Mail classe 

 

line : 231

$template_html = file_get_contents($template_path.$template.'.html');

 

If you replace it by a smarty render, maybe it can works ?

I think you will have to change the smarty delimiter, for exemple :

$smarty->left_delimiter = '<!--{';

$smarty->right_delimiter = '}-->';

 

I have the same problem as you, I'm just testing it but i have other errors on the "include", the included template is not found :(

If i find the solution, i will post here ;)

Link to comment
Share on other sites

It seems to be OK.

 

This is my code :

 

\classes\Mail.php

Line : 231 :

replace

$template_html = file_get_contents($template_path.$template.'.html');

by

$smarty = new Smarty();
$smarty->left_delimiter = '<!--{';
$smarty->right_delimiter = '}-->';
$template_html = $smarty->fetch($template_path.$template.'.html');

 

Then, in your mail templates files, add for exemple : 

<!--{include file='.\footer.html'}-->

And create your file footer.html in the same folder.

It's works !

 

Have a good day !

Edited by Ndrou (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...