Creating Hello World plugin
Step 1: Create folder for your plugin
To start writing a new plugin, open %AppData%\Blumentals\Rapid PHP\plugins folder (you can simply copy the path as-is to Windows Explorer address bar) and create a new folder. Choose any name you like such as hello world.
Step 2: Create plugin.ini
Create plugin.ini file. You can do it from Rapid PHP.
- On the File menu, select New, click Text document.
- On the File menu, click Save As.
- Navigate to the folder you just created for your plugin.
- Enter plugin.ini in File name field and click Save.
- Fill in plugin.ini with following content:
[Blumentals WeBuilder Plugin] name=Hello World enabled=1 lang=fs entry=script.js author=Your name here about=My first plugin version=1.0
Values marked bold must be changed for each new plugin that you create.
- Save the changes.
entry specifies plugin's initialization script name.
Step 3: Create script.js
Create script.js in Rapid PHP.
- On the File menu, select New, click JavaScript source.
- On the File menu, click Save As.
- Navigate to the folder of your plugin.
- Enter script.js in File name field and click Save.
- Fill in script.js with following content:
function ShowHelloWorld(Sender) { alert("Hello world!"); } Script.RegisterAction("", "Hello World", "", &ShowHelloWorld);
- Save the file.
Step 4: Test your plugin
Restart Rapid PHP. On the Plugins menu, click Hello World. If everything was done correctly, that should display Hello World! for you.
Step 5: Package plugin for distribution
After plugin has been created, you might want to install it on other computers or distribute it in Blumentals Forums. To do so, plugin must be packaged for installation.
Open your plugin's folder in Windows Explorer. Select all files. Right click, select Send to, click Compressed (zipped) folder. Zip file will be created. Rename it to represent your plugin's name and the package is ready.
Notes
- You probably already noticed that main plugin code is placed inside functions. The main body of plugin is executed during Rapid PHP initialization. During this phase script should only register required actions, connect functions to signals and create required forms and controls if any. No text/window manipulation must occur during initialization phase. If you need to do something like that during startup then use ready and installed signals.