Re: Executing a string with both html and php inside it..
| From: | Aviv Revach | Date: | Fri, 16 Mar 2001 22:26:52 +0000 |
| Subject: | Re: Executing a string with both html and php inside it.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44412@lists.php.net to get a copy of this message | ||
Hey!
Shaun, I'm really glad to say that I finally solved the problem I had with "executing a string
that contains both HTML and PHP inside it", and it's all thanks to you!
Thank you very much -
Aviv Revach
At 10:37 15/03/01 -0500, you wrote:
Hey, I glanced over your message, and you can use eval to execute php/html, but you have to open and close the <? ?> tags when you use it because eval is in php mode, not html mode. eval('?>" . $htmlandphp . '<?'); On Wed, 14 Mar 2001, Aviv Revach wrote: Hey! I would like to thank you and Mark for your quick reply. What am I trying to accomplish is the following: I have created an engine which separates my website's code and design. The code is stored in one file(code.txt) and the design in another(design.txt). The engine loads up parts of each file in order to create the final result, meaning -* It prints the "<html><head>" etc.. * It prints DESIGN.TXT's head * It prints CODE.TXT's head * It prints "</head><body>" etc.. * It prints part of DESIGN.TXT's body * It prints CODE.TXT's body * It prints the second-part of the DESIGN.TXT's body * It prints "</body></html>"That's the general idea of what the engine does, but it's doing other things as well. The engine works the way it does because I wanted to have the entire content and the entire design all in 2 separate files. Most of the engines I've seen so far, used 3 different files for the design, and included them in different places inside their content. I don't wish to do that.. Now, all worked fine until a while go, I used the 'echo' command in order to print the strings that contain content/design HTML code. The troubles began when I added PHP code to my content - The PHP tags were IGNORED... ! Now, after I've told you all the things you should know, I ask for your assistance. What do you suggest me to do? Thank you in advance - Aviv Revach At 13:26 15/03/01 +0100, Christian Reiniger wrote:On Wednesday 14 March 2001 12:50, you wrote:My string contains HTML tags with PHP code inside(in '<?php' and '?>' tags), not only PHP as eval() requires. Do you have any other suggestion?AFAIK there's no other way than using include(). Why do you need that anyway?-- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Pretty cool, the kind of power information technology puts in our hands these days. - Securityfocus on probing 36000000 hosts for known problems in 3 weeksWhat should I do in order to execute the next string: $str = "<html>\n" $str .= "blabla\n"; $str .= " <?php echo \"hello!\"; ?>\n"; $str .= "blabla\n"; $str .= "</html>\n"; When I tried using 'echo' with the string, but the php code didn't work...BRILLIANeT Website -http://www.brillianet.com/ --
BRILLIANeT Website -http://www.brillianet.com/