Sublime Forum

Really struggling here (new user NETBEANS refugee)

#1

Hi There

I wonder if someone can point me in the right direction… Mid project I have decided to dump Netbeans and switch to ST.

  1. How do you launch a web page or php script from within the editor. (Not view in browser - that just shows the file in the browser) I want to get my web server to launch the file (html, js, php and so on)

  2. How to you go back to the last edit point (very useful)

CHeers

0 Likes

#2
  1. A php site needs a web-server with php as cgi-backend. What do you expect ST to do? ST is a text editor and therefore does neighter include a webserver (with php support) nor does it contain a builtin webbrowser to display html.

  2. Maybe https://packagecontrol.io/packages/GotoLastModified

0 Likes

Build system for php files
#3

I expect ST to be able to run my file on my server - just like any other editor

edit
save
debug
edit
save
debug

0 Likes

#4

If you save the file which is located within the document root of your server, it will automatically be served.

ST doesn’t contain a debugger interface displaying all the runtime values / states of your script.

0 Likes

#5

Thanks

I don’t want a debugger, I just want to press a single key and the file to be executed. I can monitor the output of the file in the browser.

Thanks for the link to the GoToLast edit - worked a treat

Cheers

0 Likes

#6

You could create a build system that does php myfile.php or whatever and have it run your script, but as @deathaxe mentioned, if you’re using a web server isn’t PHP something that you would visit in your browser, and the web server is what executes the script and shows you the results?

0 Likes

#7

Go to “Tools -> Build System -> New Build System…” and paste this:

{
	"shell_cmd": "firefox '$file'",
	"selector": "text.html"
}

Now whenever you call “Build” on a file that is defined as an HTML document the file will open on Firefox.

The above will open the file as if you had double-clicked the HTML file, if you already have a local server running and you create a project in Sublime you can change to this:

{
	"shell_cmd": "firefox 'http://$project_base_name/$file_name'",
	"selector": "text.html"
}

In the above if your project file is called mySite.sublime-project and the file is home.html, Firefox will try to load http://mySite/home.html

If you want to create build systems to other files, like PHP, and want to know what you should put in selector, create a new file, set syntax to the file you wish to create a build system and press Ctrl+Alt+Shift+P, the text that shows in the box is what you need. For PHP that would be embedding.php.

More info on the build system can be found in the documentation manual.

0 Likes