I've posted this a few weeks ago with no response. I want to use an external "email template" as it were, so that the sales guys can edit it as they like and simply shuffle the variables around that they need $username and $password (either with or without the <?php ?> tags).
I don't want them mucking around in my code and potentially screwing it up. Not to mention having a huge 'email' text in between those HTMLMESSAGE markers is ugly as hell and ends up making the color-coding in HomeSite all kinds of whack at the end of it. I tried to use: $message = <<<HTMLMESSAGE include("/pathto/customer_email.php"); HTMLMESSAGE; But $message has the literal string ''include("/pathto/customer_email.php");'' instead of including the file. Grr.. (wouldn't it make sense that an include() should be parsed FIRST with the contents put in place basically? This seems like a 'bug' not a feature. I also tried: $filename = "/pathto/customer_email.php"; $fd = fopen ($filename, "r"); $message = fread ($fd, filesize ($filename)); fclose ($fd); But all the $username, etc. are treated as literals and if I use <?=$username?> in the customer_email.php the field is blank (like it's being parsed but doesn't have a value for it or something), instead of being converted to their actual PHP values. I also tried to put the "global" keyword in the customer_email.php file at the top. Ideally I would like to set things up so we have varoius form letter emails and I can switch them around based upon say a "special order code", where the $user/$pw is always the same (depending on the database user of course), but the email content is different formats. Is there no way to accomplish this? Am I not being clear on what it is I'm trying to accomplish? My final thought is to use some regex to search for <?=$username?> in $message after it's all been read in, and replace it with the variable $username or make up my own tag codes like [!username!] or something like that. This seems like such a hack, when PHP should be able to do this natively somehow. Surely somebody out there has had to do this type of thing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php