darga333 Posted April 26, 2006 Share Posted April 26, 2006 ex. $message = include('template.php');then i can send the $message variable to the mail(); functionthank you! darga333 Quote Link to comment https://forums.phpfreaks.com/topic/8489-is-it-possible-to-assign-a-variable-an-include-file/ Share on other sites More sharing options...
Orio Posted April 26, 2006 Share Posted April 26, 2006 This is what you need:$msg=file_get_contents(template.php);[a href=\"http://www.php.net/manual/en/function.file-get-contents.php\" target=\"_blank\"]http://www.php.net/manual/en/function.file-get-contents.php[/a] Quote Link to comment https://forums.phpfreaks.com/topic/8489-is-it-possible-to-assign-a-variable-an-include-file/#findComment-31050 Share on other sites More sharing options...
darga333 Posted April 26, 2006 Author Share Posted April 26, 2006 [!--quoteo(post=368949:date=Apr 26 2006, 02:54 PM:name=Orio)--][div class=\'quotetop\']QUOTE(Orio @ Apr 26 2006, 02:54 PM) [snapback]368949[/snapback][/div][div class=\'quotemain\'][!--quotec--]This is what you need:$msg=file_get_contents(template.php);[a href=\"http://www.php.net/manual/en/function.file-get-contents.php\" target=\"_blank\"]http://www.php.net/manual/en/function.file-get-contents.php[/a][/quote]orio you are the man! thnx!![!--quoteo(post=368952:date=Apr 26 2006, 02:58 PM:name=darga333)--][div class=\'quotetop\']QUOTE(darga333 @ Apr 26 2006, 02:58 PM) [snapback]368952[/snapback][/div][div class=\'quotemain\'][!--quotec--]orio you are the man! thnx!![/quote]problem!! when i do that, it gets the file contents, but it doesnt include the php thats inside of it as an include would, any solutions?[!--quoteo(post=368952:date=Apr 26 2006, 03:01 PM:name=darga333)--][div class=\'quotetop\']QUOTE(darga333 @ Apr 26 2006, 03:01 PM) [snapback]368952[/snapback][/div][div class=\'quotemain\'][!--quotec--]orio you are the man! thnx!!problem!! when i do that, it gets the file contents, but it doesnt include the php thats inside of it as an include would, any solutions?[/quote]what i mean by that is I have php variables inside that mail template, the variables in that mail template that i am including are determined by the file that i put the include statement infor instance... /* some php here *\$message=file_get_contents('mailer_template.php');echo $message;... it just spits out the same $messageinclude works, but it wont let me assign a variable to it like this$message = include('mailer_template.php'); Quote Link to comment https://forums.phpfreaks.com/topic/8489-is-it-possible-to-assign-a-variable-an-include-file/#findComment-31053 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.