Re: Re: Execute statements from a string???
| From: | Shawn McKenzie | Date: | Tue, 22 Oct 2002 15:55:58 +0000 |
| Subject: | Re: Re: Execute statements from a string??? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120933@lists.php.net to get a copy of this message | ||
Abridged version of my story :-)
To keep web designers out of the coding business I wrote a little script
similar to a template engine but far simpler.
How it works:
-I read an HTML file into a string
-I parse the string and echo until I reach a HTML comment <!-
-I then search the comment for a defined "command" such as [query-results]
-I then execute some PHP depending on the command
-Continue parsing...
This works great, but... What if someone wants to include actual PHP code in
the HTML file???
Hence my question.
Thanks!
Shawn
"Maxim Maletsky" <maxim@php.net> wrote in message
news:20021022165924.4E01.MAXIM@php.net...
>
> "Shawn McKenzie" <nospam@mckenzies.net> wrote... :
>
> > Thanks for the answers!
> >
> > Next question. How can I structure the string and how do I echo the HTML
and
> > the variable contents? I want the following output to the browser:
> > <td>Hello...</td>
> >
> > $somevar = "Hello...";
> >
> > $string = "<td><?php echo $somevar ?></td>\n";
> > or
> > $string = "<td>$somevar</td>\n";
> >
> > eval() ???
>
>
> let's say: you get *any* PHP code and stick it within eval('code') so,
> then it gets executed. But, why on the earth do you need it?
>
> Tell us your story, from begining to the end :)
>
>
> ---
> Maxim Maletsky
> maxim@php.net
>
>
> www.PHPBeginner.com // PHP for Beginners
> www.maxim.cx // my Home
>
> // my Wish List: ( Get me something! )
> http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3
>