PHP Driver Files: configure-source.php
This file provides the user with a web user-interface for setting up the address for your data source.
Below is an example from the text driver.
<?php //Load Defaults $filename = ""; $delimiter = "\t"; $valuecol = 2; $lookupcol = 1; //Load the existing values into the defaults if (isset($currentaddress)) { $bits = explode(':',$currentaddress); if (count($bits) > 2) { $filename = $bits[0]; $delimiter = $bits[1]; $lookupcol = $bits[2] + 1; $valuecol = $bits[3] + 1; } } //Present the UI to the user... ?> <tr><td><label style="display: inline;">Filename : </label></td><td><input id="val_address" name="filename" type="text" value="<?php echo $filename; ?>"/></td></tr> <tr><td><label style="display: inline;">Delimiter : </label></td><td><select id="val_delim" name="delimiter"><option value="\t">Tab Delimited</option><option value=",">Comma Delimited</option><option value="|">Bar (|) Delimited</option></select></td></tr> <tr><td><label style="display: inline;">Lookup Column : </label></td><td><input id="val_lookup" name="lookupcol" type="text" value="<?php echo $lookupcol; ?>"/></td></tr> <tr><td><label style="display: inline;">Value Column : </label></td><td><input id="val_val" name="valuecol" type="text" value="<?php echo $valuecol; ?>"/></td></tr>
There are two distinct sections of the file.
Loading Values
First, we setup our default values. If there is already an existing address for this data source, we then replace those defaults with the values from that existing address.
Presenting the UI
Then, we present the UI to our users in an HTML table.
Each option starts with a label, followed by the input controls needed.
<tr><td><label>My Label</label></td><td>...</td></tr>
When the user saves this information, the saveconfig-source.php file is called to take the various properties and copy them to a single string - the address that is sent to your Python driver.