loadConfig()
clonefish->loadConfig() - loads a form configuration file
Description
class clonefish { void loadConfig( string $filename ) }
A really easy way to configure the layout and other settings for a form: just create a simple .ini textfile, and you're ready to go! Clonefish has a clever built-in parser for .ini files to support loading even the layout arrays from a file.
Features of the parser:
- the first = character separates the name and value, no confusion with further =-s.
- everything after the first = character is treated as the value of the setting: no need to use " characters, you still have all the characters at your hand (you can still escape " or ' characters)
- feel free to use \n, \r and \t !
- the . character in the name helps to define arrays of any depth
- use the ; character to include comments
- use empty lines to keep the file easy to read
- you can use multiline settings: just indent the second and further lines with a space or a tab!
Examples
Example 1: a sample config file
; layout settings layout = tabular layouts.tabular.buttonrow =<tr><td colspan="2"></td><td>%s</td></tr>\n layouts.tabular.element =<tr %errorstyle%><td width="120" align="rig [...] layouts.tabular.button =<input type="submit" value="%s" /> layouts.tabular.container = <table cellpadding="5" cellspacing="0" border="0"> %s </table>
Example 2: loading a config file
<?php
$clonefish->loadConfig( 'configs/formdefaults.ini' );
?>
form validation for developers!
clonefish is a proven, mature form generator class that helps PHP developers to create, validate and process secure, flexible and easy-to-maintain formslearn more