Jump to main content Jump to doc navigation

modX.switchContext

Other versions: 3.x — Found a problem? Please edit this page or report an issue.

modX::switchContext

Switches the primary Context for the modX instance.

Be aware that switching contexts does not allow custom session handling classes to be loaded. The gateway defines the session handling that is applied to a single request. To create a context with a custom session handler you must create a unique context gateway that initializes that context directly.

Syntax

API Doc: http://api.modx.com/revolution/2.2/db_core_model_modx_modx.class.html#%5CmodX::switchContext()

boolean switchContext (string $contextKey)

Example

Switch to the 'sports' Context.

$modx->switchContext('sports');

See Also