modX.getService

Skip to end of metadata
Go to start of metadata


modX::getService

Load and return a named service class instance.

Syntax

API Doc: http://api.modxcms.com/xpdo/xPDO.html#methodgetService

object getService (string $name, [string $class = ''], [string $path = ''], [array $params = array ()])

Examples

Get the modSmarty service.

$modx->getService('smarty','smarty.modSmarty');

Get a custom, user-defined service called 'modTwitter' from a custom path ('/path/to/modtwitter.class.php'), and pass in some custom parameters.

$modx->getService('twitter','modTwitter','/path/to/',array(
  'api_key' => 3212423,
));
$modx->twitter->tweet('Success!');

See Also

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.