Each module must be registered in configuration storage (Db table “Configuration”) prior to its usage.
You can register module using special register_module() register action handler/method, which is probably the most convenient and fastest method to register new module.
void register_module (string MODULE_NAME, string CLASS_NAME, string PATH_TO_FILE);
Example:
$sm =& new vivvo_lite_site();
$sm->register_module('box_comments', 'box_comments', 'lib/vivvo/box/vivvo_box.php');
Un-Registering custom module
You may un-register the module using unregister_module(); method.
Example:
$sm->unregister_module('box_comments');
Alternatively, you can register the module directly in “Configuration” database table, without using register_module() method.
$query = "INSERT INTO `".$tbl_prefix."Configuration` (`id`, `variable_name`, `variable_property`, `variable_value`, `module`, `domain_id`, `reg_exp`) VALUES (...)
Each registered module has two elements/rows in Configuration table - the physical PHP file where the module class is, and the module class itself.
Class name:
| Parameter name | Value | Description |
|---|---|---|
| variable_name | string | the name for the box that is referenced through <vte:box> i.e. “box_comments” |
| variable_property | 'class_name' 'file' | distinguishes what you actually register, class or file; i.e. “class_name” |
| variable_value | string | value for the class_name param i.e. “box_comments” |
| module | 'modules' | module type, i.e. “module” |
| domain_id | integer | for future enhancements, not used at this point |
File:
| Parameter name | Value | Description |
|---|---|---|
| variable_name | string | the name for the box that is referenced through <vte:box> i.e. “box_comments” |
| variable_property | 'class_name' 'file' | distinguishes what you actually register, class or file; i.e. “file” |
| variable_value | string | value for the file param, path to PHP module file i.e. “lib/vivvo/box/vivvo_box.php” |
| module | 'modules' | module type, i.e. “modules”. For more on module types, refer to THIS |
| domain_id | integer | for future enhancements, not used at this point |
Example #1: Most convinient and fastest way is to register module via $site_manager.
$sm =& new vivvo_lite_site();
$sm->register_module('box_sections', 'box_sections', 'lib/vivvo/box/vivvo_box.php');
Example #2: Another way is to register module via SQL directly, i.e. in default Vivvo installer.
(NULL, 'box_sections', 'class_name', 'box_sections', 'modules', 1, NULL), (NULL, 'box_sections', 'file', 'lib/vivvo/box/vivvo_box.php', 'modules', 1, NULL),
First SQL insert tells vivvo that module named 'box_sections' uses box_sections class and second that that class is located in vivvo_box.php (path relative to vivvo root).