sebastians Posted August 23, 2013 Share Posted August 23, 2013 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 More sharing options...
vekia Posted August 23, 2013 Share Posted August 23, 2013 maybe you can just append the code to the email footer file? It will be much easier for parser Link to comment Share on other sites More sharing options...
sebastians Posted August 23, 2013 Author Share Posted August 23, 2013 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 More sharing options...
r4nonE Posted October 14, 2013 Share Posted October 14, 2013 Is there anyone that has found a solution? I would like to add a common code in all email html files. Sebastians, how have you solved? Thanks, Daniel. Link to comment Share on other sites More sharing options...
sebastians Posted October 14, 2013 Author Share Posted October 14, 2013 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 More sharing options...
Ndrou Posted October 29, 2013 Share Posted October 29, 2013 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 More sharing options...
Ndrou Posted October 29, 2013 Share Posted October 29, 2013 (edited) 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 October 29, 2013 by Ndrou (see edit history) Link to comment Share on other sites More sharing options...
sebastians Posted October 29, 2013 Author Share Posted October 29, 2013 Hi Ndrou, thanks for posting! I will have a look and see whether that works. Thanks again, Sebastian Link to comment Share on other sites More sharing options...
Ndrou Posted October 29, 2013 Share Posted October 29, 2013 Just for precision, tested on Prestashop 1.5.6.0. Link to comment Share on other sites More sharing options...
Ndrou Posted October 30, 2013 Share Posted October 30, 2013 (edited) I've created an article here for frenchies http://www.ndrou.fr/2013/10/29/gerer-les-includes-templates-les-emails-prestashop/ Edited October 30, 2013 by Ndrou (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts