bman22 Posted September 24, 2008 Share Posted September 24, 2008 I am working on a site in which i need it to print text from a file to a form. Right now i am using the include function. Main problem with this is, i want the ability to edit php code in a the box, and with include, the code is processed. I am wondering if there is a way to print the text from a file, ignoring all php code so i get the whole thing in the textarea. Link to comment https://forums.phpfreaks.com/topic/125557-not-proccessing-php/ Share on other sites More sharing options...
xtopolis Posted September 24, 2008 Share Posted September 24, 2008 echo the file_get_contents as htmlentities($contents)... that would cause all code tags to be changed into HTML equivalents.. meaning they won't be seen as code? Link to comment https://forums.phpfreaks.com/topic/125557-not-proccessing-php/#findComment-649185 Share on other sites More sharing options...
bman22 Posted September 27, 2008 Author Share Posted September 27, 2008 no. I actually want the opposite of this. I want it to show me the code. for example right now for testnig i try putting in <?php print"Hi"; ?> and when i reload the page, it gives me just the php translated Hi without any other code.I want a php script that will allow users to edit their php scripts Link to comment https://forums.phpfreaks.com/topic/125557-not-proccessing-php/#findComment-651750 Share on other sites More sharing options...
xtopolis Posted September 27, 2008 Share Posted September 27, 2008 try it first. It will show "the code". htmlentities replaces things like < and > with & gt; (no space), & lt; (no space), so that they will show as the symbol, but not be interpreted as code. Link to comment https://forums.phpfreaks.com/topic/125557-not-proccessing-php/#findComment-651757 Share on other sites More sharing options...
bman22 Posted September 27, 2008 Author Share Posted September 27, 2008 im not sure exactly how to do this. I am still rather new to php, and your explination is not very clear. Some example code would be nice. Link to comment https://forums.phpfreaks.com/topic/125557-not-proccessing-php/#findComment-652089 Share on other sites More sharing options...
xtopolis Posted September 28, 2008 Share Posted September 28, 2008 <?php $str1 = '<b>hi</b>'; echo "String 1: ".$str1; echo '<br />'; echo "HTMLENTITIES: ".htmlentities($str1); ?> Put that into a php script, upload/test it, and you'll see what I mean. Link to comment https://forums.phpfreaks.com/topic/125557-not-proccessing-php/#findComment-652138 Share on other sites More sharing options...
bman22 Posted October 1, 2008 Author Share Posted October 1, 2008 no. i understand that fine, but how do i load text from another file and run it through the htmlentities so that i can print the code from another file nevermind. I figured it out. Thanks for the help Link to comment https://forums.phpfreaks.com/topic/125557-not-proccessing-php/#findComment-654499 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.