I am modifying an existing source code viewer script in PHP that I found on the web. It is to store source code in a nice category fashion.
I am having a problem now though. Below is a screen shot of me viewing the source code in Firefox, you can see the part that is supposed to show on the screen but for some reason it is not showing on the screen, it is showing up in the source of the page though so I am really confused as to why I cannot view it in the browser? You will also notice that the text color is Pink/Purple color. The part inside the
Please not that it is not any CSS that is making it hidden or anything.
alt text http://img2.pict.com/cd/d2/74/2663869/0/screenshot2b209.png
<?phpis considered as an opening tag, which is only closed by?>; and the browser doesn’t display tags themselves.The
<td>tags, for instance, are not displayed by your browser : they are interpreted to create a table ; it’s the same with the<?phptag… But it doesn’t generate any output, as the browser doesn’t know what to do with it.If you want to actually display your portion of PHP code in the HTML page, you have to encode it to HTML entities :
<should be converted to<>should be converted to>&should be converted to&"should be converted to"This way, you’ll get some valid HTML, and not “things looking as HTML tags”.
But note that if you want that portion of PHP code to actually be interpreted (So the query to the database is executed, and generates some output), you’ll have to re-configure your webserver, so PHP code is interpreted : you should not see the PHP code on the browser-side.