How can I use PHP to show the source code of a page.
EG
http://www.mysite.com/source.php?page=article.php
Then it shows the soruce for that page?
| SitePoint Sponsor |





How can I use PHP to show the source code of a page.
EG
http://www.mysite.com/source.php?page=article.php
Then it shows the soruce for that page?





You can see how php.net does it, here: http://php.net/source.php?page_url=/source.php and how DevShed does it, here: http://www.devshed.com/Source/index....rce/index.html .
Hope this helps...





Basically in your apache conf file you have aline that says
AddType application/x-httpd-php-source .phps
Then you save a file called whatever.phps inyour browser you will see the color-highlighted source code. I am sure you can pull off something like what devshed and php.net do with a little coding.
Please don't PM me with questions.
Use the forums, that is what they are here for.
Bookmarks