To use a Registry function, we just need to get a reference to
the $registry object and call it:
<?php
// Load the registry class definition require_once HORDE_BASE . '/lib/Registry.php';
// Get a reference to the registry object $registry = &Registry::singleton();
// Test to see if the method exists: if ($registry->hasMethod('projects/add')) { // Go ahead and add a project $projectID = $registry->call('projects/add', array('name' => 'A new project')); } else { echo 'projects/add is not defined'; }
?>
That's all. The Registry takes care of everything else, and you
get back the ID of the newly created project.
|