Open Source Content Management System

Midgard PHP superglobals

  1. $_MIDGARD
    1. Undocumented array members
  2. $_MIDCOM

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:

  • host is the database ID of the current host record
  • style is the database ID of the current loaded style
  • pageis the database ID of the current page record
  • debug tells whether the mgd_debug_start function has been called
  • uri contains the full virtual path of the current Midgard request
  • prefix contains the possible host prefix
  • self contains the path of the current page record without virtual path information
  • user is the database ID of the current authenticated user, or 0
  • admin contains TRUE or FALSE depending whether current user is an sitegroup administrator
  • root contains TRUE or FALSE depending whether current user is an root administrator
  • lang contains the current language code
  • sitegroup contains the database ID of the current sitegroup
  • config is an array containing configuration information:
    • prefix is the installation prefix used for Midgard, as reported by the midgard-config --prefix command
    • multilang contains TRUE or FALSE depending whether the Multilang module is enabled
    • quota contains TRUE or FALSE depending whether the Quota module is enabled
  • argc contains an integer counting number of items in the virtual path
  • argv contains an array of items in the virtual path
  • types contains an array of registered midgard types
  • cookieauth contains TRUE or FALSE depending whether cookie was send for current authenticated request ( depreciated )
  • auth contains TRUE or FALSE depending whether authentication was sucesfull for current request
  • schema is an array containing information about loaded Midgard schemas
    • types is an array containing list of loaded schema types

Undocumented array members

  • author
  • quota
  • ah_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 FALSE for 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, $_MIDCOM is 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 of midcom_application for now if you want to know more.

Torben Nehmer (MidCOM Lead Developer)

See the MidCOM API reference for more complete list.

Designed by Nemein, hosted by Anykey