Tapatalk

Show PHP file in browser?

Show PHP file in browser?

1
NewbieNewbie
1

    Aug 28, 2008#1

    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.

    6,685587
    Grand MasterGrand Master
    6,685587

      Aug 29, 2008#2

      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.
      Best regards from an UC/UE/UES for Windows user from Austria

      40
      Basic UserBasic User
      40

        Sep 07, 2008#3

        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 UltraEdit / UEStudio make a tool like

        Command line: C:\Windows\system32\WScript.exe C:\Windows\test.vbs "%f"
        Working directory: C:\Windows\
        Options: DOS program + Save active file, no capture

        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 for opening the page in Opera:

        C:\Windows\system32\WScript.exe C:\Windows\test.vbs "%f" op

        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
        test.zip (1.45 KiB)   629

        4
        NewbieNewbie
        4

          Dec 06, 2009#4

          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 website 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.
          An example which 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:\Windows\system32\WScript.exe 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).
          live_browser_test.zip (2.07 KiB)   487