Installation
Unzip the downloaded file and upload them to your server or local directory. Open up “class.ezfc_config.php” and edit the following settings to your needs:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// backend password private $backend_password = "ezfc"; // database config public $hostname = "localhost"; public $username = "root"; private $password = ""; public $dbname = "ezfc_php"; public $prefix = "ezfcphp_"; // plugin base url - make sure to add a trailing / at the end // example: $plugin_url = "http://www.your-website.com/ezfc-php/"; public $plugin_url = "http://localhost/ezPlugins/ezfc-php/"; |
Save it and upload all files to your server. Make sure that you can access it in the browser.
Open up the directory you have uploaded the files into and you should see the setup page. If you have configured everything correctly, click on install and the database will be setup.
Add forms
After the installation was successful, you should see a new section labeled “ez Form Calculator” in the control panel.
Forms are being added via templates. The default template is blank. In future, more and more templates will be added by default.
Make sure you choose “blank” to create an empty form and click on “add by template” to proceed.
You should now see that a new form has been added:
Now, you can add elements as you please. Elements are displayed on the right side. Simply click on an element to add it to your current form.
After the element has been added, click on the item to show more element options. See the Element Options section for further details.
Element Options
Name: For internal use only.
Label: This text will be displayed to the user as well as in emails.
Required: If this options is checked, the user has to fill out this field before submitting.
Calculate_enabled: When checked, this field will be taken into calculations. If not, this field is just a basic input field (e.g. email, name etc.).
Factor: Input value will be multiplied by the factor, e.g: factor value is 5 and the user value is 2 –> 5*2 = 10.
Min: Minimum value.
Max: Maximum value.
Calculate: The first of two fields is the operator (add, subtract, multiply and divide), the second field is the value to operate with.
Placeholder: This text will be shown as a placeholder value only.
Class: You can add a css-class manually this way.
Settings
With ez Form Calculator (short: ezfc), you are able to add as many forms as you like. Each one has its own configuration which you can all edit individually.
At first, it is a good idea to edit the global settings. Under the main menu point, choose “Global settings”. Here, you can edit every single option which will be used for all new forms.
Email recipient
When a new entry was added, this recipient will receive a new mail immediately. Leave blank if you do not want to receive any email notifications.
Submission message
This text will be displayed when a form has been submitted.
Spam protection in seconds
Every x seconds, a user (identified by IP address) can submit a form.
Show required char
Whether a notification about required fields should be shown or not.
Currency
Pretty obvious, isn’t it?
Captcha public key / private key
This script uses Googles Recaptcha plugin. You would need a public as well as a private key in order to make it work. Used for spam prevention.
Overwrite settings
Only check this option when you are totally sure to overwrite ALL EXISTING FORM SETTINGS.
Customization
ez Form Calculator distinguishes between front- and backend. You can edit colours, layout etc. in the following css files:
- Backend: /ez-form-calculator-phpstyle-backend.css
- Frontend: /ez-form-calculator-php/style-frontend.css
PHP integration
Check out the file index.php in the directory ezfc-php-example. It is essential to do the following steps:
Put the following lines at the start of the page:
1 2 3 4 5 6 7 |
<?php require_once("../ezfc-php/class.ezfc_config.php"); require_once("../ezfc-php/class.ezfc_frontend.php"); $ezfc_config = new Ezfc_config(); $ezfc_frontend = new Ezfc_frontend($ezfc_config); ?> |
This will load the config and the frontend script. Place the following line right before the closing <head>-tag:
1 |
<?php $ezfc_frontend->get_header(); ?> |
This will load all relevant CSS styles. In order to dislay a form, write the following line anywhere between the header and the footer:
1 |
<?php echo $ezfc_frontend->get_output(1); ?> |
Where the first argument is the form id (1 in this example). Additionally, write the following line right before the closing-tag:
1 |
<?php $ezfc_frontend->get_footer(); ?> |