note 60514 added to function.highlight-file
| From: | dtroi50 at gmail dot com | Date: | Mon, 09 Jan 2006 22:39:28 +0000 |
| Subject: | note 60514 added to function.highlight-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-101468@lists.php.net to get a copy of this message | ||
If you run a site that has PHP script examples and you want to show the source, instead of a phps
file, just add the following code to the top of the script.
<?php
if(count($_GET)) {
highlight_file(__FILE__);
}
?>
Then to make a source link use this:
<?php
print'<a href="?source">Show source</a>';
?>
Note that you don't have to use souce. If any get variables are set, it'll work.
-Tom
----
Manual Page -- http://www.php.net/manual/en/function.highlight-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60514
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60514&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60514&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60514&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60514&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60514&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60514&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60514&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60514&report=yes
Search -- http://master.php.net/manage/user-notes.php