Home Download Buy Blog Forum Support

Need help to develop plugin

Need help to develop plugin

Postby vikaskbh on Tue Jan 11, 2011 4:47 pm

Hello,

I need to run php script on dos directly through sublime editor.

i.e. Tools > packages > Run PHP Script

Whenever I invoke "Run PHP Script", I need dos to run "php.exe filename.php" in current file's directory.

Could you help me to do so? will save my lots of time.

PS: I am using Windows 7 and have licensed copy of "Sublime Text"

Regards,
Vikas
vikaskbh
 
Posts: 15
Joined: Fri Sep 17, 2010 6:49 am

Re: Need help to develop plugin

Postby jps on Tue Jan 11, 2011 8:29 pm

You can use the build system functionality for this.

Use "Tools/New Build System" to create a new one, then set the build line to:

Code: Select all
build php.exe $File


(assuming that php.exe is in the PATH), and workingDir to $FilePath. Save it as PHP.sublime-build, and you should see it in the "Tools/Build Systems" menu.

There's more documentation at http://www.sublimetext.com/docs/build
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Need help to develop plugin

Postby vikaskbh on Sat Jan 15, 2011 4:34 am

Yes, It worked thanks for the support. :)
vikaskbh
 
Posts: 15
Joined: Fri Sep 17, 2010 6:49 am

Re: Need help to develop plugin

Postby vikaskbh on Mon Jan 17, 2011 3:12 pm

Hello Admin,

It would be great, if you help for the same in Sublime X

Code: Select all
# See http://www.sublimetext.com/docs/build for details
build make
lineNumberRegex ^(...*?):([0-9]*):?([0-9]*)
showWhenFinished true
workingDir $ProjectDir
build php.exe $File


Raise the error attached in screenshot.



Please Guide.
Attachments
php_build.png
php_build.png (65.68 KiB) Viewed 1559 times
vikaskbh
 
Posts: 15
Joined: Fri Sep 17, 2010 6:49 am

Re: Need help to develop plugin

Postby jps on Wed Jan 19, 2011 11:18 am

The syntax of the .sublime-build files has changed in Sublime Text X, they're now JSON based - have a look at some of the others, such as Python/Python.sublime-build.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Need help to develop plugin

Postby vikaskbh on Thu Jan 20, 2011 12:27 pm

Thank you for pointing that out.

following code worked for me to add PHP build menu.

Code: Select all
{
   "cmd": ["php", "$file"],
   "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
   "selector": "source.php"
}
vikaskbh
 
Posts: 15
Joined: Fri Sep 17, 2010 6:49 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 4 guests

cron