Zend - The PHP Company




Source Viewers

Add Code


Viewing HTML source  

Type: code fragment
Added by: mikecarrmi
Entered: 02/03/2000
Last modified: 08/12/1999
Rating: **** (8 votes)
Views: 9265
This is a little fragment that will return the currently viewed page as raw text for easy debugging of HTML glitches.


<?
   
if($view_source) {
      
Header('Content-Type: text/plain');
   }
?>

<A HREF="<? echo $PHP_SELF;?>">Click here for raw source</A>


Usage Example


<?php
   
if($view_source) {
     
Header('Content-Type: text/plain');
}
?>
<HTML>
<HEAD>
   <TITLE>Test document</TITLE>
</HEAD>
<BODY>

<H1>Test document</H1>

<HR>
<A HREF="<? echo $PHP_SELF?>?view_source=1">View HTML source</A>

</BODY>
</HTML> 


Rate This Script





Search



This Category All Categories