Eu tinha um problema chato. Quando eu queria visualizar um arquivo .php no Notepad++ ele executa no navegador, mas como arquivo local e não no Wamp.
Eu ia no menu Executar -> Lounch in Chrome
01.png 35.91KB
0 downloads
E no navegador aparece assim:
02.png 19.14KB
0 downloads
Então dei uma pesquisada de como configurar o Notepad++ para quando executar no navegador abrir o arquivo com http://localhost/_testes/testing.php e vi que pelo Npp não conseguiria. Então eu criei um script PHP que redireciona o arquivo de local para HTTP.
Na pasta raiz do domínio localhost crie o arquivo lh.redirect.php e nele coloque o código abaixo.
Como eu uso Wamp, o meu é C:/wamp/www/.
<?php
/*
* Por Ennio Sousa http://uid.me/shzlot
* 05/08/2015
*
* file:///C:/wamp/www/path/file.php
* http://localhost/path/file.php
* use http://localhost/lh.redirect.php?path=$(FULL_CURRENT_PATH)
*/
$BASE_DIR = "C:\wamp\www";
$BASE_URL = "http://localhost"; // http://127.0.0.1
// verificar se o paramentro path foi informado
$PATH_WIN = (isset($_GET['path']))? $_GET['path'] : 0 ;
if($PATH_WIN){
echo $PATH_WIN;
$PATH_HTTP = str_replace($BASE_DIR, $BASE_URL, $PATH_WIN);
header("HTTP/1.1 301 Moved Permanently");
header("Location: $PATH_HTTP");
}
else{
echo "Não foi informado o parametro <b>path=</b>";
}
?>
Depois você vai precisar abrir a pasta C:\Users\[seu usuário]\AppData\Roaming\Notepad++\ . Para facilitar segure o botão do menu iniciar e depois pressione a letra R e cole URL a baixo no Executar do Windows
%USERPROFILE%\AppData\Roaming\Notepad++\
03.png 9.51KB
0 downloads
Abra o Bloco de Notas como administrador e depois abra o arquivo shortcuts.xml para editar.
Procure por
chrome "$(FULL_CURRENT_PATH)"
E substitua por
chrome "http://localhost/lh.redirect.php?path=$(FULL_CURRENT_PATH)"
<NotepadPlus>
<InternalCommands />
<Macros>
<Macro name="Trim Trailing and save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
<Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
<Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
</Macro>
</Macros>
<UserDefinedCommands>
<Command name="Launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes" Key="88">firefox "$(FULL_CURRENT_PATH)"</Command>
<Command name="Launch in IE" Ctrl="yes" Alt="yes" Shift="yes" Key="73">iexplore "$(FULL_CURRENT_PATH)"</Command>
<Command name="Ver no Chrome" Ctrl="yes" Alt="yes" Shift="yes" Key="82">chrome "http://localhost/lh.redirect.php?path=$(FULL_CURRENT_PATH)"</Command>
<Command name="Launch in Safari" Ctrl="yes" Alt="yes" Shift="yes" Key="70">safari "$(FULL_CURRENT_PATH)"</Command>
<Command name="Get php help" Ctrl="no" Alt="yes" Shift="no" Key="112">http://www.php.net/%20$(CURRENT_WORD)</Command>
<Command name="Google Search" Ctrl="no" Alt="yes" Shift="no" Key="113">http://www.google.com/search?q=$(CURRENT_WORD)</Command>
<Command name="Wikipedia Search" Ctrl="no" Alt="yes" Shift="no" Key="114">http://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command>
<Command name="Open file" Ctrl="no" Alt="yes" Shift="no" Key="116">$(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD)</Command>
<Command name="Open in another instance" Ctrl="no" Alt="yes" Shift="no" Key="117">$(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD) -nosession -multiInst</Command>
<Command name="Send via Outlook" Ctrl="yes" Alt="yes" Shift="yes" Key="79">outlook /a "$(FULL_CURRENT_PATH)"</Command>
</UserDefinedCommands>
<PluginCommands />
<ScintillaKeys />
</NotepadPlus>
Feche e abra novamente o Notepad++ para ter efeito as alterações.
Quando você for executar novamente, o URL a ser aberto será http://localhost/lh.redirect.php?path=C:/wamp/www/_testes/testing.php
E então o script irá redirecionar para http://localhost/_testes/testing.php
04.png 19.2KB
0 downloads










