Each URL Handler must be registered in configuration storage (Db table “Configuration”) prior to its usage.
You can register URL Handler using special register_url() register method, which is probably the most convenient and fastest method to register new URL Handler.
bollean register_url (string URL, string PATH_TO_FILE, string URL_HANDLER, string CONTENT_HANDLER);
Example:
$sm =& new vivvo_lite_site();
$um =& $sm->get_url_manager();
$um->register_url('archive', 'lib/vivvo/url_handlers/archive.php', 'archive_url_handler', 'archive_content_handler');
Un-Registering custom URL Handler
You may un-register the URL Handler using unregister_url(); method.
Example:
$sm =& new vivvo_lite_site();
$um =& $sm->get_url_manager();
$um->unregister_url('archive');
Alternatively, you can register the Url Handler directly in “Configuration” database table, without using register_url() method.
$query = "INSERT INTO `".$tbl_prefix."Configuration` (`id`, `variable_name`, `variable_property`, `variable_value`, `module`, `domain_id`, `reg_exp`) VALUES (...)
Each registered URL Handlers has two or three elements/rows in Configuration table
File:
| Parameter name | Value | Description |
|---|---|---|
| variable_name | string | the name for the URL i.e. “archive” |
| variable_property | 'file' | distinguishes what you actually register |
| variable_value | string | value for the file param, path to PHP URl handler file i.e. “lib/vivvo/url_handlers/archive.php” |
| module | 'modules' | module type, i.e. “url_modules” |
| domain_id | integer | for future enhancements, not used at this point |
URL Handler:
| Parameter name | Value | Description |
|---|---|---|
| variable_name | string | the name for the URL i.e. “archive” |
| variable_property | 'url_handler_function' | distinguishes what you actually register |
| variable_value | string | name of URL Handler function i.e. “archive_url_handler” |
| module | 'modules' | module type, i.e. “url_modules” |
| domain_id | integer | for future enhancements, not used at this point |
Content Handler:
| Parameter name | Value | Description |
|---|---|---|
| variable_name | string | the name for the URL i.e. “archive” |
| variable_property | 'content_handler_function' | distinguishes what you actually register |
| variable_value | string | name of Content Handler function i.e. “archive_content_handler” |
| module | 'modules' | module type, i.e. “url_modules” |
| domain_id | integer | for future enhancements, not used at this point |
Example #1: Most convinient and fastest way is to register URL Handler via $site_manager.
$sm =& new vivvo_lite_site();
$um =& $sm->get_url_manager();
$um->register_url('my_url.html', 'my_url.php', 'my_url_url_handler', 'my_url_content_handler');
Example #2: Another way is to register module via SQL directly, i.e. in default Vivvo installer.
(NULL, 'my_url.html', 'file', 'my_url.php', 'url_modules', 1, NULL), (NULL, 'my_url.html', 'url_handler_function', 'my_url_url_handler', 'url_modules', 1, NULL), (NULL, 'my_url.html', 'content_handler_function', 'my_url_content_handler', 'url_modules', 1, NULL),