Log in

View Full Version : Display source rather than print it



TheJoshMan
07-27-2008, 08:41 PM
Not sure if this is in the right place, if not you can move it to wherever you feel like it should be...

Does anyone know how to display the different syntaxes of programming languages on an html document? Like, let's say I want something like this:



<html>
<head />
<body>
<?php
echo("HI");
?>
</body>
</html>


How can I get the codes to show up and not print to screen?

motormichael12
07-28-2008, 02:00 AM
&lt;html&gt;
&lt;head /&gt;
&lt;body&gt;
&lt;?php
echo("HI");
?&gt;
&lt;/body&gt;
&lt;/html&gt;

To do this quickly just run it through htmlentites() php function

TheJoshMan
07-28-2008, 02:02 AM
I really don't want to have to type out each character individually, but i'm not that great at php... How would I go about running it through that function?

motormichael12
07-28-2008, 02:19 AM
http://www.w3clubs.com/htmlentities.php

Does it for you :)

If this helps can you thank me? that way I finally have a thank :)

TheJoshMan
07-28-2008, 03:11 AM
EXACTLY what I was looking for!

Thank you very much! I really appreciate it.