phps handlers
Cool trick to avoid making duplicates or symlinks to .php files in order for people to view your crappy php source. Also nice when your webhosting doesn't provide a handler for .phps. Go go more .htaccess fu and php'ness.
In summary place the following in a .php file somewhere, like viewsource.php or phpsrc.php:
<?phpThen add the following 2 lines to .htaccess:
$file = preg_replace("/\\.phps$\", ".php", $_SERVER[\'PATH_TRANSLATED\']);
$file = realpath($file);
if (!file_exists($file)) {
print("Error: No such file!!");
} else {
highlight_file($file);
}
?>
AddType php-source .phps Action php-source /viewsource.phpreplace viewsource.php with your file name of choice, and viola! For example, see the AAWC Formatter and its source. Cheers, Steve
<< Home