The Hubzilla
 All Classes Namespaces Files Functions Variables Pages
Zotlabs\Web\Router Class Reference

Public Member Functions

 __construct (&$a)
 Router constructor. More...
 
 Dispatch (&$a)
 

Private Attributes

 $modname = ''
 
 $controller = null
 

Detailed Description

We have already parsed the server path into App::$argc and App::$argv

App::$argv[0] is our module name. Let's call it 'foo'. We will load the Zotlabs/Module/Foo.php (object) or file mod/foo.php (procedural) and use it for handling our URL request to 'https://ourgreatwebsite.something/foo' . The module file contains a few functions that we call in various circumstances and in the following order:

Object:
class Foo extends \Zotlabs\Web\Controller {
function init() { init function }
function post() { post function }
function get() { normal page function }
}
Procedual interface:
foo_init()
foo_post() (only called if there are $_POST variables)
foo_content() - the string return of this function contains our page body

Modules which emit other serialisations besides HTML (XML,JSON, etc.) should do so within the module init and/or post functions and then invoke killme() to terminate further processing.

Constructor & Destructor Documentation

Zotlabs\Web\Router::__construct ( $a)

Router constructor.

Parameters
[in,out]App&$a
Exceptions
Exceptionmodule not found
Hooks:
module_loaded Called when a module has been successfully locate to server a URL request. This provides a place for plugins to register module handlers which don't otherwise exist on the system, or to completely over-ride an existing module. If the plugin sets 'installed' to true we won't throw a 404 error for the specified module even if there is no specific module file or matching plugin name. The plugin should catch at least one of the module hooks for this URL.
  • string module
  • boolean installed
  • mixed controller - The initialized module object

Member Function Documentation

Zotlabs\Web\Router::Dispatch ( $a)
Parameters
[in,out]App&$a

Call module functions

Member Data Documentation

Zotlabs\Web\Router::$controller = null
private
Zotlabs\Web\Router::$modname = ''
private

The documentation for this class was generated from the following file: