petenaylor Posted April 9, 2012 Share Posted April 9, 2012 Hi all How can I shut off the PHP tag in the below code so I can edit the email message in WYSIWYG? I want to be able to create a HTML email and then insert it into the PHP message string: $message = " <html> <head> <title>HTML email</title> </head> <body> <p>This email contains HTML Tags!</p> <table> <tr> <th>Firstname</th> <th>Lastname</th> </tr> <tr> <td>John</td> <td>Doe</td> </tr> </table> </body> </html> "; Many thanks Pete Link to comment https://forums.phpfreaks.com/topic/260605-html-email/ Share on other sites More sharing options...
Muddy_Funster Posted April 9, 2012 Share Posted April 9, 2012 erm....what? Link to comment https://forums.phpfreaks.com/topic/260605-html-email/#findComment-1335606 Share on other sites More sharing options...
petenaylor Posted April 9, 2012 Author Share Posted April 9, 2012 Basically, I have a huge HTML email that I want to drop into the $message string. I have got to go through the many lines and add the slashes in if I do it in the above example. Is there a way that I can close the PHP tag ?> and open it again at the end? Link to comment https://forums.phpfreaks.com/topic/260605-html-email/#findComment-1335608 Share on other sites More sharing options...
Muddy_Funster Posted April 9, 2012 Share Posted April 9, 2012 yip, <?php /** You PHP Code */ ?> Your HTML <?php /** More PHP Code */ ?> BUT there are other ways, fling this into a new php file and run it: <?php $var = "variables"; $message = <<<HTML_MSG <html> <head><title></title></head> <body> <p>You'll find these string blocks rather handy at times like this</P> <table border="1"> <tr> <th colspan="2">Easy way to use string blocks in php</th> </tr> <tr> <td>1: make a variable and set it = to</td> <td>2: Openm the string block with <<<NAME_OF_BLOCK using that format(no spaces)</td> </tr> <tr> <td>3: Enter your formated string, including php $var if you want them</td> <td>4: Close the string block with NAME_OF_BLOCK; - on it's own line with no white space before or after it</td> </tr> </table> </body> </html> HTML_MSG; echo $message; ?> Link to comment https://forums.phpfreaks.com/topic/260605-html-email/#findComment-1335613 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.