Re: [PHP] Executing a string with both html and php inside it..
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 "htmlhead" etc.. * It prints DESIGN.TXT's head * It prints CODE.TXT's head * It prints "/headbody" 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? What 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... -- 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 3600 hosts for known problems in 3 weeks BRILLIANeT Website - http://www.brillianet.com/ -- BRILLIANeT Website - http://www.brillianet.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Executing a string with both html and php inside it..
Hey! The function 'eval()' can't be used here. I already tried working with it and failed. eval() is being used for running PHP code. 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? Thank you in advance - Aviv Revach At 18:54 14/03/01 -0500, Andrew Hill wrote: Aviv, eval() http://www.php.net/manual/en/function.eval.php Best regards, Andrew On 3/13/01 6:35 PM, "Aviv Revach" [EMAIL PROTECTED] wrote: Hey! What 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... Is there any way of doing this without writing this string to a file and include'ing it? (that would be rather slow!) Thank you in advance - Aviv Revach BRILLIANeT Website - http://www.brillianet.com/ BRILLIANeT Website - http://www.brillianet.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Executing a string with both html and php inside it..
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? What 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... -- 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 3600 hosts for known problems in 3 weeks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Executing a string with both html and php inside it..
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 "htmlhead" etc.. * It prints DESIGN.TXT's head * It prints CODE.TXT's head * It prints "/headbody" 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? What 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... -- 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 3600 hosts for known problems in 3 weeks BRILLIANeT Website - http://www.brillianet.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Executing a string with both html and php inside it..
On Wednesday 14 March 2001 16:26, you 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). [...] Now, after I've told you all the things you should know, I ask for your assistance. What do you suggest me to do? I'd say use another approach. Separating code and design is good, but keeping each on only one file will cause more troubles that it's worth. I keep all my design in one directory, as several files, each a snippet of HTML (usually with some ?= $SomeVar ? statements embedded): misc_hitcounter_g.html misc_hitcounter_s.html page_footer-titel.html page_footer.html page_header-titel.html page_header.html page_toc-linkmarked.html page_toc-linkstd.html page_toc.html mail_subscribe-failure.html mail_unsubscribe-failure.html mail_subscribe-success.html mail_unsubscribe-success.html news_item-std.html news_item-std.html for example looks like this (it's a german site): tr valign="top" td colspan="2" height="2"img src="/images/transparent.gif" width="1" height="1"/td /tr tr valign="top" td p class="bb"?= $PTime ?/p /td td p class="bb"?= $Title ?/p /td /tr tr valign="top" ?php if ($Usermode == 'maint') { ? tda href='/maintain.php?what=newsamp;id=?= $ID ?amp;action=edit' class='inbody'Bearbeiten/a/td ?php } else { ? tdnbsp;/td ?php } ? td?= $Body ?/td /tr Such an approach is IMHO easy to understand and handle, well-structured etc. -- 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 3600 hosts for known problems in 3 weeks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Executing a string with both html and php inside it..
Hey! What 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... Is there any way of doing this without writing this string to a file and include'ing it? (that would be rather slow!) Thank you in advance - Aviv Revach BRILLIANeT Website - http://www.brillianet.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]