Actions

JFactory/getConfig

From Joomla! Documentation

Revision as of 14:47, 23 November 2008 by Chris Davenport (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Returns a reference to the global configuration object, only creating it if it doesn't already exist. The object returned will be of type JRegistry.

Syntax

object JRegistry getConfig( $file, $type )

where:

Argument Data type Description Default
$file string Path to the configuration file. If null then path-to-joomla/libraries/joomla/config.php is assumed. null
$type string Type of configuration file. 'PHP'

Example

This method is used to get access to the global configuration variables. In this example, the site name is retrieved.

$config =& JFactory::getConfig();
echo 'Site name is ' . $config->getValue( 'config.sitename' );

See also