RE: [PHP] Show php code
| From: | Jack Dempsey | Date: | Sat, 12 Apr 2003 20:33:29 +0000 |
| Subject: | RE: [PHP] Show php code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143623@lists.php.net to get a copy of this message | ||
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...
> -----Original Message-----
> From: Frappy John [mailto:frappyjohn@dos2linux.org]
> Sent: Saturday, April 12, 2003 4:21 PM
> To: php-general@lists.php.net
> 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 "<" and ">". 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
>
>