I use SciTE mostly for PHP development and I was looking for a method
to see the generated html code of a php file I'm editing. I run a
local webserver (Apache). I want to run this via the "Go" command
(F5). My approach is to give the full path of the file to a batch file
(html.bat) that

1) substitute backslash "\" with slash "/"
2) substitute the webroot directory with "http://localhost";
3) use the resulting url with lynx to retreive the html source

So a file
d:\www\subdir\index.php
will be translated to the url
http://localhost/subdir/index.php
(d:\www\ is my webroot)

# SciTeUser.properties
command.go.$(file.patterns.php)=html.bat $(FilePath)

My first attempt of html.bat put the generated html in the output pane:

@echo off
echo %1 | sed -e s/\\/\//g | sed -e s/d:\/www\//http:\/\/localhost\//i
 | lynx -source -

Then I realize that the syntiax hilight of SciTE can help me to spot
some errors, so the second version of html.bat put the code in a temp
file and open it in scite:

@echo off
echo %1 | sed -e s/\\/\//g | sed -e s/d:\/www\//http:\/\/localhost\//i
 | lynx -source - > d:\temp\tmp.html
C:\Programmi\scite\SciTE.exe d:\temp\tmp.html

I find this solution very useful to me and I want to share. Suggestion
to improve this method (htmltidy?) are welcome.

Note:
I work on Windows 2000 and I have installed sed (and other useful
apps) from unxutils http://unxutils.sourceforge.net and lynx textual
browser http://lynx.browser.org. If you are on *nix system you already
must have both.

--
Scaracco

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to