Jump to content


Photo

is it possible to assign a variable an include file?


  • Please log in to reply
2 replies to this topic

#1 darga333

darga333
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 26 April 2006 - 06:48 PM

ex.

$message = include('template.php');

then i can send the $message variable to the mail(); function

thank you!

darga333

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 26 April 2006 - 06:54 PM

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]
Think you're smarty?

(Gone until 20 to November)

#3 darga333

darga333
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 26 April 2006 - 07:05 PM

[!--quoteo(post=368949:date=Apr 26 2006, 02:54 PM:name=Orio)--][div class=\'quotetop\']QUOTE(Orio @ Apr 26 2006, 02:54 PM) View Post[/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) View Post[/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) View Post[/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 in

for instance...

/* some php here *\

$message=file_get_contents('mailer_template.php');
echo $message;

... it just spits out the same $message
include works, but it wont let me assign a variable to it like this
$message = include('mailer_template.php');




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users