Re: HTML source of a php outputted document?
| From: | idban secandri | Date: | Mon, 10 Jul 2000 13:44:13 +0000 |
| Subject: | Re: HTML source of a php outputted document? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5717@lists.php.net to get a copy of this message | ||
At 15:21 10/07/00 +0200, you wrote:
This is a real newbie HTML question, but I just wanted to know before I start to double my work by writing the same thing in two files all the time: I want to display some sample HTML source of a web page that's php3 generated, i.e. not show the php3 source but the html source it generates. The tricky part is that I want to do this on a web page. A horrible solution would be to call a function for each < and >, and if $source is defined output < and > in their place... won't make the code any prettier though. ;) Are there any more elegant solutions?hope this help <? $filename = "/location/of/html/file.html"; $fd = fopen( $filename, "r" ); $contents = fread( $fd, filesize( $filename )); $contents = htmlspecialchars($contents); echo "<pre>$contents"; fclose( $fd ); ?> -- Doubt whom you will, but never yourself. http://php.klik.or.id -- latest code == valid link!