Midgard PHP superglobals
Midgard registers two superglobal variables for PHP, $_MIDGARD and $_MIDCOM. These superglobals are always available for Midgard-powered PHP scripts.
$_MIDGARD
The $_MIDGARD superglobal is an array containing runtime information about the Midgard environment. The following array members are populated:
hostis the database ID of the current host recordstyleis the database ID of the current loaded stylepageis the database ID of the current page recorddebugtells whether the mgd_debug_start function has been calleduricontains the full virtual path of the current Midgard requestprefixcontains the possible host prefixselfcontains the path of the current page record without virtual path informationuseris the database ID of the current authenticated user, or 0admincontainsTRUEorFALSEdepending whether current user is an sitegroup administratorrootcontainsTRUEorFALSEdepending whether current user is an root administratorlangcontains the current language codesitegroupcontains the database ID of the current sitegroupconfigis an array containing configuration information:prefixis the installation prefix used for Midgard, as reported by themidgard-config --prefixcommandmultilangcontainsTRUEorFALSEdepending whether the Multilang module is enabledquotacontainsTRUEorFALSEdepending whether the Quota module is enabled
argccontains an integer counting number of items in the virtual pathargvcontains an array of items in the virtual pathtypescontains an array of registered midgard typescookieauthcontainsTRUEorFALSEdepending whether cookie was send for current authenticated request ( depreciated )authcontainsTRUEorFALSEdepending whether authentication was sucesfull for current requestschemais an array containing information about loaded Midgard schemastypesis an array containing list of loaded schema types
Undocumented array members
authorquotaah_prefix
$_MIDCOM
The $_MIDCOM superglobal is where MidCOM stores the midcom_application object, the main controlling instance of the MidCOM framework. The following public methods are available:
- dynamic_load - load another MidCOM page into the current style
- generate_error - Generate a HTTP error
- get_context_data - get information about a selected context
- get_current_context - get the ID of current context of
FALSEfor global context - relocate - Redirect user to another URL
A quick note:
This method listing is largly incomplete, I'll complete this as soon as I have the time.
Basically,
$_MIDCOMis the main primary entry point for everything you do nowadays with MidCOM. It provides access to all services as member variables, like$_MIDCOM->cache->content->no_cache(). You need to check the API docs ofmidcom_applicationfor now if you want to know more.Torben Nehmer (MidCOM Lead Developer)
See the MidCOM API reference for more complete list.
