Jump to content

Adding and using configuration settings

From NusaATK
Revision as of 16:27, 3 September 2008 by Lorna (talk | contribs) (typo)

ATK Howto: Adding and using configuration settings

Complexity: Easy
Author: Lorna Mitchell <lorna@ibuildings.com>

List of other Howto's

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.