I want to display code in my page and have the browser show it as code. i see this done a lot with a nice colored background . how is this done?
An excellent way to do it is with GeSHi... I use it both here in the forum: <?php echo 'hello world!'; ?> PHP: <html> <head> <title>Hello world!</title> </head> <body> This is stuff in the body! </body> </html> HTML: It has a plug-in system that supports syntax highlighting for 56 languages.
... precisely, as you've said it, however, in particular for the code that needs to start each line in a new line I prefer the "pre" tags, or better yet, the "code" tags would not work at all in this case (without additionaly styling them) tayiper
IF it is just a raw HTMl page and you dont have any scripting support you could always use the ASCII values for the code. Using the ASCII values means they wont be rendered as HTML but instead as text but they will display the HTML value. Dan
I was looking for the same and found the solution for this. Have a look at How to show html as text in php?
Exactly. But since there is no answer and Google returns this page from search, I thought I would better add this to help others.