Page 1 of 1

need to display some php/html code on my webpage

Posted: Tue Nov 17, 2009 3:10 pm
by me666
i have a file, file A... i want to display the contents of that file on a webpage, i have done this but as file A is html/php it displays part of the code but displays other parts as you would see them upon loading file A as a webpage.. i just want to display the code as text.. any ideas?
thank you :)

Re: need to display some php/html code on my webpage

Posted: Tue Nov 17, 2009 3:15 pm
by iankent
use htmlspecialchars() to format the text - it'll replace things like < with < making sure it shows up as text not HTML :)

edit: e.g.
$text = "<html>blah</html";
$text = htmlspecialchars($text);

hth

Re: need to display some php/html code on my webpage

Posted: Tue Nov 17, 2009 3:17 pm
by me666
ah ha, excellent thanks for the quick response :)