[PHP] Printing PHP Source with a PHP Script

2003-12-14 Thread Gohaku
Hi everyone,
I'm trying to output PHP source within a PHP Script.  The following 
script seems to work(Viewing HTML Source reveals the PHP Source), but 
the Browser output is very different.  Is there a function or header I 
should set before echoing the PHP Source?  Thanks.

?
//filereader.php
//script arguments: filereader.php?file=
$fh = fopen($file,rb);
$src = fread($fh,filesize($file));
fclose($fh);
echo 'htmlmeta http-equiv=Content-Type content=text/plain';
echo $src;
echo '/html';
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Printing PHP Source with a PHP Script

2003-12-14 Thread John W. Holmes
Gohaku wrote:

Hi everyone,
I'm trying to output PHP source within a PHP Script.  The following 
script seems to work(Viewing HTML Source reveals the PHP Source), but 
the Browser output is very different.  Is there a function or header I 
should set before echoing the PHP Source?  Thanks.

?
//filereader.php
//script arguments: filereader.php?file=
$fh = fopen($file,rb);
$src = fread($fh,filesize($file));
fclose($fh);
echo 'htmlmeta http-equiv=Content-Type content=text/plain';
echo $src;
echo '/html';
?
echo htmlentities($src);

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Printing PHP Source with a PHP Script

2003-12-14 Thread Mike
John W. Holmes wrote:
Gohaku wrote:

Hi everyone,
I'm trying to output PHP source within a PHP Script.  The following 
script seems to work(Viewing HTML Source reveals the PHP Source), but 
the Browser output is very different.  Is there a function or header I 
should set before echoing the PHP Source?  Thanks.

?
//filereader.php
//script arguments: filereader.php?file=
$fh = fopen($file,rb);
$src = fread($fh,filesize($file));
fclose($fh);
echo 'htmlmeta http-equiv=Content-Type content=text/plain';
echo $src;
echo '/html';
?
echo htmlentities($src);

there is a function just for this

highlight_file($file);

is all you need

Mike

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Printing PHP Source with a PHP Script

2003-12-14 Thread Gohaku
On Sunday, December 14, 2003, at 09:51 PM, John W. Holmes wrote:

Gohaku wrote:

Hi everyone,
I'm trying to output PHP source within a PHP Script.  The following 
script seems to work(Viewing HTML Source reveals the PHP Source), but 
the Browser output is very different.  Is there a function or header 
I should set before echoing the PHP Source?  Thanks.
?
//filereader.php
//script arguments: filereader.php?file=
$fh = fopen($file,rb);
$src = fread($fh,filesize($file));
fclose($fh);
echo 'htmlmeta http-equiv=Content-Type content=text/plain';
echo $src;
echo '/html';
?
echo htmlentities($src);

Thank you, that's just what I was looking for.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php