Show PHP file in browser?

Help with setting up and configuring custom user tools in UltraEdit (based on command line input)

Show PHP file in browser?

Postby hakmir » Thu Aug 28, 2008 5:36 pm

Hi Guys,

When I click "show file in browser" in Ultraedit I want it to open in this address "http://localhost/myphpfiles/helloworld.php" because this is the only way php file will show. But instead it opens it in this address "file:///C:/wamp/www/myphpfiles/70a1f~ue.php".

I don't have problem with temporary files but this address "file:///C:/wamp/www/myphpfiles/" doesn't work with php and of course even temporary file will not show anything on browser. It has to start with localhost. Can you help me?

Thanks in advance.
hakmir
Newbie
 
Posts: 1
Joined: Thu Aug 28, 2008 5:28 pm

Re: Show PHP file in browser?

Postby Mofi » Fri Aug 29, 2008 2:34 am

Define a user tool and run this tool if you want to see your PHP file in your preferred browser. Some examples about the definition of such a user tool are:

View in Firefox/ Explorer / Opera
How do I CHANGE THE DEFAULT BROWSER setting??

See also the IDM power tips Integrate Yahoo!, Google, Wikipedia and more with UltraEdit and Creating user and project tools.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3936
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Show PHP file in browser?

Postby hveld » Sun Sep 07, 2008 3:52 am

Attached is a .vbs file that I wrote to test pages through a local http server.
Basically it translates a full local path to a http:// URL, and then sends a command to a browser to open the URL.

Put it in some folder like C:\WINDOWS\ and edit the '===EDIT HERE=== section so that paths are valid for your system.
Then in UE make a tool like
Command Line: C:\WINDOWS\test.vbs "%f"
Working dir: C:\WINDOWS\
Options: DOS program + Save active file

This tool will open the currently edited page through a local server in the default browser, as defined in test.vbs (may be other than system default).
For another browser, it should be specified in tool command line, like
C:\WINDOWS\test.vbs "%f" op
to open the page in opera

I have 3 separate tools for IE(default), Firefox and Opera.

It works if the file to be tested is under the server root (could be in a subfolder) or in a mapped virtual folder (if some conditions are met, see comments in code).
You can easily make it work for any file no matter where it is, for example by making a temp copy in server root
Attachments
test.zip
(1.45 KiB) Downloaded 337 times
User avatar
hveld
Basic User
Basic User
 
Posts: 42
Joined: Tue Nov 16, 2004 12:00 am

Re: Show PHP file in browser?

Postby chrisdfeld » Sun Dec 06, 2009 3:22 pm

hveld wrote:Attached is a .vbs file that I wrote to test pages through a local http server.

Thanks very much for the script. I have created an updated version (attached below) with some minor changes and enhancements:

  • Accepts the web site URL and www root path as command-line parameters, so a single copy of the script can be reused for multiple projects
  • Default browser line-up changed to include IE, Firefox, Safari, Google Chrome and the latest version of Opera; Netscape Navigator deleted (good riddance)
  • Minor code cleanup with expanded instructions and browser settings that are simpler for non-programmers to change
Most users will not need to edit the attached VBS file to use it.

The new command-line usage is as follows:
Code: Select all
live_browser_test.vbs <url_prefix> <www_root_path> <file_path> [browser]

  • Do not include a trailing forward slash after <url_prefix>
  • Do not include a trailing backslash after <www_root_path>
  • Valid options for [browser] are: ie, firefox, opera, safari, chrome (or the corresponding number you see in the VBS file). Naturally you must have the desired browser already installed. You can edit the VBS file to add additional browsers.
Example (launches http://dev.mysite.com/index.php in Firefox):
Code: Select all
live_browser_test.vbs http://dev.mysite.com "C:\MySite\www" "C:\MySite\www\index.php" firefox

In UltraEdit, create the tool entry under Advanced -> (Project) Tool Configuration as in the original instructions, but with the following updated command line:
Code: Select all
C:\PATH\live_browser_test.vbs http://dev.mysite.com "C:\MySite\www" "%f" [browser]

Replace PATH with the location of the VBS file and [browser] with the browser name of your choice (listed above).
Attachments
live_browser_test.zip
(2.07 KiB) Downloaded 202 times
User avatar
chrisdfeld
Newbie
 
Posts: 4
Joined: Sun Dec 06, 2009 1:45 pm


Return to Custom User Tools/Tool Configuration