Page 1 of 1

how to display php code read only on a .php page?

Posted: Mon Jan 19, 2004 11:22 am
by Pash
Hi there,

I have been searching for ages for code that will allow me to display php code stored in a databse on a page that will ignore the php syntax as ive typed it in a form. Alot like the forums here with the code tags. Can ne1 point me to a tutorial or give me some examples, will be greatly apprechiated thx

Pash

Posted: Mon Jan 19, 2004 11:49 am
by mikusan
Correct me if i am worng, if you just want to display PHP code, with no fancy coloring, you just don't include the <?php -- ?> php tags....
Or just regex and aget rid of them depending on what you are trying to do.

Most of my code uses concatenation anyways to parse my HTML templates, so whe i want to show the code i just concatenate a string containing the php code.

But that's the basics anyways.

Posted: Mon Jan 19, 2004 4:19 pm
by Pash
thx for your help m8, i never just thought about leaving the tags out lol :(, but if for good practice i did does anybody know other ways to do it.

Thanks again

Posted: Mon Jan 19, 2004 4:25 pm
by DuFF
Check out highlight_file in the PHP manual.

Posted: Tue Jan 20, 2004 3:28 am
by kettle_drum
Or just replace < and > with the html entities - < >

Posted: Tue Jan 20, 2004 3:37 am
by patrikG
Image