Convert 7 email templates to PHP
- or -
Post a project like this- Posted:
- Proposals: 5
- Remote
- #1266170
- Completed
Description
Kind of development: Customization of existing website
Num. of web pages/modules: 7
Description of requirements/features: I have 7 web email template in HTML. I need someone to replace all images and colors, etc...with php variables to make it dynamic easily
It is a very easy (and a little boring) job.
Find attached the first template + an example of what i need to clarify things
Emmanuel I.
100% (49)New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
When must this project be finished?
-
Hi Emannuel, that's not the best approach, you should use file_get_contents and replace the variables from an array of key=>value
-
The example you gave is not the best way to do it, you should use get_file_content and an array:
function load_body_mail_from_file($template) {
return file_get_contents(ABSPATH . EMAILSDIR . $template);
}
function replace_codes_in_email_template($testid, $template) {
$variables = array('SITEURL' => $_SERVER['SERVER_NAME'], 'FB_BUTTON' => 'https://www.facebook.com/link1', 'TWITTER' => 'Twitter', 'TEST_ID' => $testid, 'YEAR' => date("Y"));
foreach ($variables as $key => $value) {
$template = str_replace('{{ ' . $key . ' }}', $value, $template);
}
return $template;
}Emmanuel I.30 Aug 2016Thanks for your advice but i str_replace() is much longer than extract() the variables from an array in a php view file, that can goes into cache by the way.
Well there are numerous way of doing things in php ;) -
Hi Emmanuel
When you need this to be complete?
Thanks
Emmanuel I.30 Aug 2016asap
Gurpreet K.30 Aug 2016Hi
Thanks for your reply
From my side It will take approximately 14 to 15 working days.
Thanks -
do you have a backedn of some sort? can you provide more information as oposed to vague details that you've provided? i.e. do you need a backend to be created as well? how do you want to use the PHP variables to make the html templates dynamic etc??
Emmanuel I.30 Aug 2016What is vague in "replace the values with variables" ? that is the only requirement.. i handle all the rest from a codeigniter mail sending based website