470,864 Members | 1,997 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,864 developers. It's quick & easy.

How to display PHP without running script

Hi,

I have a page that basically just displays a directory listing of gif
files (along with displaying the file)..
http://gummibearheads.com/ign/icons/iconpage.php
In case you were wondering, they are avatars for a message board...

I want to be able to show visitors the php code if they want to do the
same thing. Its there a way to do this besides copying the file and
making it a text file?

Before you ask, I dont have any passwords or such listed in there...
Jul 17 '05 #1
3 1600
Mark Gray wrote:
I want to be able to show visitors the php code if they want to do the
same thing. Its there a way to do this besides copying the file and
making it a text file?

Copy it to iconpage.phps (or make a symbolic link) and go to
http://yourserver/whatever.phps

NB: The web server must be properly configured to handle phps files.

Or you can use the highlight_file() function.
http://www.php.net/highlight_file

All the pages on the PHP site have a "Show source" link at the bottom.
You can copy the way they did it.
http://www.php.net/source.php?url=/index.php

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2
In article <e9**************************@posting.google.com >, Mark Gray wrote:
I have a page that basically just displays a directory listing of gif
files (along with displaying the file)..
http://gummibearheads.com/ign/icons/iconpage.php
In case you were wondering, they are avatars for a message board...

I want to be able to show visitors the php code if they want to do the
same thing. Its there a way to do this besides copying the file and
making it a text file?


viewsource.php

<?php readfile('iconpage.php'); ?>

--
http://home.mysth.be/~timvw
Jul 17 '05 #3
"Mark Gray" <pe******@yahoo.com> wrote in message
news:e9**************************@posting.google.c om...
Hi,

I have a page that basically just displays a directory listing of gif
files (along with displaying the file)..
http://gummibearheads.com/ign/icons/iconpage.php
In case you were wondering, they are avatars for a message board...

I want to be able to show visitors the php code if they want to do the
same thing. Its there a way to do this besides copying the file and
making it a text file?

Before you ask, I dont have any passwords or such listed in there...


show_source($filename);
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by DettCom | last post: by
4 posts views Thread by drew197 | last post: by
1 post views Thread by andre.labonte | last post: by
4 posts views Thread by Mantorok | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.