Michelle wrote:
I am taking a class in PHP and thought that it would be nice to display
the PHP code that generated my pages when the user clicked a link (or
submit button). I have seen page that will display the underlying HTML
on the page and it would be a nice touch...I think
Is there a way to do this?
http://www.php.net/highlight_file
Example:
<?php
echo '<p>Hello World!</p>';
highlight_file($_SERVER['PHP_SELF']);
?>
The HTML output is (reformatted):
<p>Hello World!</p><code>
<font color="#000000">
<font color="#0000CC"><?php<br /></font>
<font color="#006600">echo </font>
<font color="#CC0000">'<p>Hello World!</p>'</font>
<font color="#006600">];<br/></font>
<font color="#0000CC">highlight_file</font>
<font color="#006600">(</font>
<font color="#0000CC">$_SERVER</font>
<font color="#006600">[</font>
<font color="#CC0000">'PHP_SELF'</font>
<font color="#006600">]</font>
<font color="#006600">);<br /></font>
<font color="#0000CC">?><br /></font>
</font>
</code>
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--