Re: Double Click file to have it open in Windows Explorer
| From: | malte | Date: | Tue, 13 May 2003 23:17:19 +0000 |
| Subject: | Re: Double Click file to have it open in Windows Explorer | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-19914@lists.php.net to get a copy of this message | ||
I figured out a way to do what this guy (sorry, forgot the name) intended to do.
Its a Registry, PHP, JavaScript Combination..
first open regedit.exe and open the HKEY_CLASSES_ROOT tree
search for .php and note the value of that key. (in my case Maguma_Studio.PHPFile)
now search for search for that value in the HKEY_CLASSES_ROOT tree.
When you found it, open it and the shell key underneath, create a new key
and name it execute, assign a value to it like "open from webserver" this is what
you'll see in
the context menu if you right click a php file
in the execute key you just created, create a new key and name it command (this is important)
assign something like this to it
"C:\Programme\Internet Explorer\iexplore.exe" -nohome "http://localhost/execute.php?path=%1"
the first parameter is your browser executable, i don't know what the second one does, but it
works though.
The third is the file itself.
What you gotta do now is create a file in you document root and name it execute.php
then paste this code in it
<html>
<head>
<title>Execute</title>
<script language="JavaScript">
<?
$yourroot = "htdocs/";
$path = $HTTP_GET_VARS['path'];
$path = str_replace("\\", "/", $path);
$path = str_replace("//", "/", $path);
$pos = strpos($path, $yourroot);
$pos += (strlen($yourroot));
?>document.location.href='<? echo "http://localhost/".substr($path,
$pos);?>';
</script>
</head>
<body>
You probably won't ever read this...
</body>
</html>
The last thing you gotta do is define $yourroot. So if your docRoot is
"c:\apache\somecrap\" make it $yourroot='somecrap/'
it is a slash not a backslash mind you.
let me know if this was any help or if it doesn't work
diggn