Re: how?
| From: | Jason Stechschulte | Date: | Thu, 03 May 2001 15:30:53 +0000 |
| Subject: | Re: how? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51285@lists.php.net to get a copy of this message | ||
On Thu, May 03, 2001 at 03:56:55PM -0700, elias wrote:
> No, ...
> Actually,...
> I want it so generic,
> like myfile.txt can have like:
> -
> Welcome $username
> Enjoy your staying at: $site_name
> Mail admin. at $admin_mail for any questions...
> -
> so bascially, i don't want to do str_replace or else i could have used the
> sprintf() and with '%s' instead of str_replace...
>
> i even tried the eval() which should work, but it didn't, scroll down to
> message with Subject: $hello
I don't think you understand eval(). Either that or I don't. If I
understand correctly, eval(); requires a complete PHP statement.
Welcome $username is not a complete PHP statement.
Why don't you just make myfile.txt a valid php file and then include it?
myfile.txt.php:
Welcome <?php echo $username;?>
Enjoy your staying at: <?php echo $site_name;?>
Mail admin. at <?php echo $admin_mail?> for any questions...
index.php:
<?php
$username="eddie";
$site_name="stripmall";
$admin_mail="admin@stripmall.com";
include("myfile.txt.php");
?>
I'm not sure if this is what you want, but it will send this to the
browser:
Welcome eddie
Enjoy your staying at stripmall
Mail admin. at admin@stripmall.com
--
Jason Stechschulte
jpstech@unoh.edu
--
Think of prototypes as a funny markup language--the interpretation is
left up to the rendering engine.
-- Larry Wall in <199710221710.KAA24242@wall.org>