Adding and using configuration settings: Difference between revisions
Appearance
Adding a quick outline of working with config vars |
m typo |
||
| Line 2: | Line 2: | ||
Adding a new configuration setting can be very useful, and in ATK its very easy. In config.inc.php, just add a line which sets the variable, e.g.: | Adding a new configuration setting can be very useful, and in ATK its very easy. In config.inc.php, just add a line which sets the variable, e.g.: | ||
<php | <syntaxhighlight lang="php"> | ||
$config_foo = 'bar'; | $config_foo = 'bar'; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 16:27, 3 September 2008
|
ATK Howto: Adding and using configuration settings
|
Adding a new configuration setting can be very useful, and in ATK its very easy. In config.inc.php, just add a line which sets the variable, e.g.:
$config_foo = 'bar';
The variable name must start with $config.
To retrieve variables, either ones you've added or existing ones, use the atkconfig() function and supply the name of the variable you want.
atkconfig("foo");
This would return the variable $config_foo from the config file. Arrays can also be handled in this way. The atkconfig() call can be used from within your module and attribute classes.