I am trying to get the option Run->Launch With Firefox; to open the file I am currently viewing in Notepad++ at http://127.0.0.1:8080/currentfile.php
, but instead it just opens to current file directory in Firefox.. I've tried to edit the shortcut xml file in the Notepad++ directory, I've shut Notepad++ down and edited the XML file with regular Notepad, and when I start Notepad++ back up it does not show the settings I entered.. How can I edit the settings to load localhost rather than the file directory in Firefox?
Here's a quick and dirty fix to run php files even if they are in subdirectories inside your document root. In shortcuts.xml:
<Command name="Launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes" Key="88">firefox "http://localhost/redirect.php?file=$(FULL_CURRENT_PATH)"</Command>
Then create the file "redirect.php" in your web server document root:
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
$file = str_replace('\\', '/', $_GET['file']);
$file = str_replace($root, '', $file);
header("Location: http://localhost{$file}");
well two things
you edited the wrong file , i'm guessing you are using windows vista/7 so real preferences files are in C:\Users\user\AppData\Roaming\Notepad++
i don't think that notepad++ has a variable that contains only half of the address
meaning : the variable used now is $(FULL_CURRENT_PATH) == file:///C:/server/htdocs/pages/example.php
so you don't have any variable that contains only this pages/example.php.
so i think it's impossible
but just keep the page open and refresh after editing
If you save your PHP file directly into the www directory of WAMP (no subfolders), you can execute it by selecting the "Run..." command and pasting in this line:
firefox.exe "http://localhost/$(FILE_NAME)"
It's not great, but it will help you debug in a jiffy.
I know this is an older question but:
A. Gneady's solution works well. However, it may require some modification on Windows so the DOCUMENT_ROOT is replaced before the slash directions are replaced. Otherwise, no replacement will be made and the $file will output the same as the original path and file name, except with the slashes reversed.
Since I test in multiple browsers, I modified all of the pertinent rows in C:\Users[username]\AppData\Roaming\Notepad++\shortcuts.xml:
<Command name="Launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes" Key="88">firefox "http://localhost/redirect.php?file=$(FULL_CURRENT_PATH)"</Command>
<Command name="Launch in IE" Ctrl="yes" Alt="yes" Shift="yes" Key="73">iexplore "http://localhost/redirect.php?file=$(FULL_CURRENT_PATH)"</Command>
<Command name="Launch in Chrome" Ctrl="yes" Alt="yes" Shift="yes" Key="82">chrome "http://localhost/redirect.php?file=$(FULL_CURRENT_PATH)"</Command>
<Command name="Launch in Safari" Ctrl="yes" Alt="yes" Shift="yes" Key="70">safari "http://localhost/redirect.php?file=$(FULL_CURRENT_PATH)"</Command>
Then create the "redirect.php" file in the web root directory as follows:
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
$file = $_GET['file'];
$file = str_replace($root, '', $file);
$file = str_replace('\\', '/', $file);
header("Location: http://localhost{$file}");
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With