Creating ARDEX-Pages for the web

Consumption calculator

Implementation

The PHP-Code is built in a way that it generates the JavaScript-Code for the calculator which is used for the website and the app. There is NO dependency on an external library such as jQuery, etc.

For now, the calculator is available for

de (german)
nl (dutch)
fr (french)
and en (english)
 
 
Example-Implementation (PHP-Code which generates JS-Code):

In order to get the Javascript-Code for the calculator of ARDEX B10 in english:


<?
include_once "vbr.php";
$vbr=new vbr();
$shortname=$vbr->makeShortname("ARDEX B 10",$uid);
$vbr=$vbr->getVbr($shortname,"ARDEX B 10",false,$lang);

echo $vbr;
?>
<a onClick="openVBR()">Consumption calculator</a>


$uid: is a product-ID. It is only necessary to separate ARDEX WA (the product exists twice, but with the same name) $uid=101 is the grout, $uid=91 is the adhesive. (these ids are used for ARDEX WA in the german product-database, you can change these values in vbr.php)

The comment "false" in "getVBR" means that the code will not be generated for the app, but for the website.
 
The variable $lang can be de,fr,en or nl at the moment.


The function makeShortname removes all white-spaces from the productname. The resulting name is a unique name, which is used in all other functions. The problem with products like "ARDEX WA" is solved with a special id.


 
In order to set up new products (or to change them), the following functions have to be added directly to the code:
 
- getGebinde: creates the product information for each product.
- getForm: creates the HTML-form for each product (here, the calculation factors are transferred to the following function, too).
- getFormel: creates the JS-Code for the calculation.
 
-getVbr: assembles the JS-Code from all 3 above mentioned functions."
 



Translations

According to the setting of the $lang-variable a tranlation-file is included. This file is named

vb_LANG.php  (exampe: vbr_fr.php for the french version)


The file exists of 2 tables, they represent the tranlations german->targetLanguage:

The first table ("$trans_single") is for all translations like "1 bucket" ("one thing").

The second table ("$trans_plural") is for all translations like "2 buckets" ("more than one thing").

Background: In some languages (like german) the singular and plural word for bucket is "Eimer" (like "1 Eimer" or "2 Eimer")

 

Download

The download includes translations for de,nl,fr and en. 

Download

Updates / Fixes:

10.08.2012 : Some plural words were not correctly translated in the plural-matrix