PHP Extensions
This unique tool gives user options to customize and create custom functions to you your needs. Extensions work on one of the most popular programing ;languages on the web - php.
Server Setup
First of all to use zebroid php extensions you have to copy and properly set up php server. It should be placed in to the "Zebroid\php plugins\server\".
5.3 Version of the server is required.
For those who don't need to customize server you can get already set up archive from http://zebroid.us/uploads/files/server.7z - siply unzip and place it in the proper folder.
Development and Initiation of custom extensions
User can create activate and initiate php extention. The top part contains the list of available extensions. With the help of content menu. use can:
- Create new extension
- Activate already existing one
- Delete an extension
- or change name/description of the already existing
Bottom part is divided on: extension initiation settings (input properties) and extension process log.
Extension Initiation settings - is an initial properties required for php extension running presses. They are created by extension developer (how to do this described below), and field in before extension initiation.
Extension proses result - browser that displays massages about extension run. What it will show entirely depends on the developer.
Initiation will initiate process.
Developing and working with scripts
Each extension must have at least one executable file - index.php. It is created automatically and can't be deleted. If initiated zebroid executes this particular file. To add additional files use content menu.
With the help of content menu you can:
- Create a new file
- Open an existing one (the content of which will be displayed in the editor to your right)
- Rename file
- Delete file
- Save selected file
- Close selected file without changes
Two buttons are located under the list of files: Save amd Save All. They are necessary for file editing. First saves changes in the current file, second in all of them.
Attention: due to file initiation form hard drive - before each run you need to save all of the changes - to see proper results.
In order to successfully develop an extension you need to know the following:
- PHP
- Zebroid API , which you can learn here: http://zebroid.us/forum/viewtopic.php?f=16&t=738
- All input properties are stored as variables which are selected by the developer. For example if you have property Option1, then script can get the value through variable declaration $Option1
- Commands echo, print and so on display result in the browser window but you can only see it after the script finished running
- Folder "Zebroid\php plugins\classes\" is common for all extensions therefore it is convenient to place classes or set of functions for different extensions.
How to create extension property
Data format is the same as in ini files, were the group name equal to variable in the extension script therefore must be unique.
Parameters of each group :
- Caption - property destination value
- Type - property type (description below)
- Value - property initial value
- Options - property options (are necessary only for some)
Типы свойств:
- Text - simple text field. Value serves as initial property value, doesn't require any Options.
- SpinEdit - numeric property. Value serves as initial property value, Input Options filled in with maximum an minimum values as well as value of the step. For example: Min=0; Max=100; Step=1. Returns numeric value.
- ComboBox - carries Value of initial active element and the list. Example: in this instance "Value 1; Value2 {!}; Value 3" list will consist of 3 elements, but the default active one will be the second one marked with the symbol {!}. Returns the number of user-selected values, the count starts from zero.
- CheckBox - checkbox property. Values serves as the initial value of the property(true - active, false - inactive), doesn't require any Options. Returns -1 if active and 0 if inactive.
- FilePath - text box with a button that opens a file selection window. Value serves as the initial property value, Options filled out with information of file extensions. Example: "Options=*.php;*.txt". Returns field value in form of text.
- FolderPath - text box with a button that opens a folder selection window. Value serves as the initial property value, doesn't require any Options. Returns field value in form of text.
- Tracker - Value serves as the initial property value, Options filled out with maximum and minimum property values information. Example: "Min=0; Max=100". Returns numeric value of trucker position.
- Radio - switch list. carries Value of initial active element and the list. Example: in this instance "Value 1; Value2 {!}; Value 3" list will consist of 3 elements, but the default active one will be the second one marked with the symbol {!}. Returns the number of user-selected values, the count starts from zero.
Content menu property editor contains templates of each of the property types.