At 2003-04-12 16:33 -0400, Jack Dempsey wrote:
>you can also make a copy of the file with a .phps extension, and if you have
>it configured, the source code will show up, nicely colorized, etc...

Before I read about the .phps extension (which
probably stands for php source), I used:

ln -s mysource.php mysource.php.txt

This makes clear that it's actually a .php file, but
it should be shown as a regular .txt file. I think
that the advantage of this method is that the number
of new extensions that are needed stays more limited.
Otherwise each script language (.pl, .py) needs it's
own source code extension (.pls., .pys) and in fact
the file isn't different, it just has to be handled
differently. Perhaps it would be better if it had
been coded in the protocol, so the http:// part.
Perhaps it would also have been better when .html
files would have been automatically generated from
.php files. So if you ask for index.html or index.htm
and there is an index.php file it would be executed
by the server and it's output would be send instead.
The output is namely really HTML code. It would then
also be possible to look at the source code under
it's actual name with the .php extension. (Of course
only when the file would have the proper permissions.)

Greetings,
Jaap


>> -----Original Message-----
>> From: Frappy John [mailto:[EMAIL PROTECTED]
>> Sent: Saturday, April 12, 2003 4:21 PM
>> To: [EMAIL PROTECTED]
>> Cc: Pag
>> Subject: Re: [PHP] Show php code
>>
>>
>> > How can i make a print to the screen of php (or even
>> > html) code without executing it?
>>
>> If you want to display an entire source file via your
>> server, the simplest way is to rename your .php file with a
>> .txt extension or, if you want to retain the file as
>> working php, make a symbolic link to it:
>>
>>       ln -s mysource.php mysource.txt
>>
>> Most servers are configured to treat a .txt file as plain
>> text and include a mime header to that effect. Most
>> browsers will honor the header. (If your file *begins* with
>> an <html> or <?xml> tag, however, some browsers will format
>> it despite the header. So start with <?php> or plain text. )
>>
>> If, however, you want to include the source as part of a
>> formatted HTML page, you will have to replace all the "<"s
>> and ">"s with "&lt;" and "&gt;". A regular expression
>> should do the trick.
>>
>> A quick and dirty workaround (to avoid learning regex :) is
>> to include your code in a <form><textarea>. That seems to
>> come through in raw format.
>>
>> (The HTML <code> tag you tried to use is for formatting
>> purposes only, i.e. to make the code look like code [i.i.e.
>> printed in a crude lineprinter font :]  It's not specific
>> to any programming language.)
>>
>> --John
>>
>>
>> On Saturday 12 April 2003 12:47 am, Pag wrote:
>> > HI again,
>> >
>> >     How can i make a print to the screen of php (or even
>> > html) code without executing it? I mean, i want to
>> > display some php/html code on the site without the
>> > browser interpreting it.
>> >     I tried using,
>> >
>> >     <CODE>
>> >     insert html/php here
>> >     </CODE>
>> >
>> >     but doesnt work.
>> >
>> >     Thanks.
>> >
>> >     Pag
>>
>> --
>> 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


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

Reply via email to