PHP/JavaScript environment variables

These variables contain information about the Zenario content item being served, the identity of who's logged in, and other environment variables.

You can access them from PHP code (in a module) using syntax of the form:

ze::$variableName

Most can also be accessed from JavaScript code, see the individual description pages. They can be accessed using the following syntax:

zenario.variableName

Example

To show content item ID and type variables in JavaScript, write this in a Raw HTML/JavaScript snippet plugin, or in JavaScript applied to content items, layouts, or site-wide:

console.log(zenario.cID);
console.log(zenario.cType);

This example should display the currently viewed content item's ID and type in the browser's console.

Environment variables are defined in zenario/basicheader.inc.php and may be populated in the autoload classes, as well as zenario/js/visitor.js file

ze::$adminId

When Zenario is running in admin mode, this holds the id of the administrator who is currently logged in.

ze::$adminVersion

This contains the latest version of a content item - i.e. the version that an administrator would see.

ze::$alias

The alias (or friendly name) of the current content item.

ze::$cID

The id of the current content item.

ze::$cType

The type of the current content item, e.g. documenthtmlpicture...

ze::$cVersion

When an admin or a visitor is looking at a content item, this contains the version of a content item which is currently in view.

In visitor mode this will always be equal to the ze::$visitorVersion variable.

ze::$equivId

The equivalence id of the current content item.

ze::$isDraft

This will be set to true when an administrator is looking at a draft version of a content item.

ze::$langId

The language id for the current content item.

ze::$layoutId

The id of the layout that the current content item is using.

ze::$locked

This will be set to true in admin mode when an administrator is viewing a content item that has been checked out by another administrator.

ze::$skinId

The id of the skin that the current content item is using.

ze::$status

The status of the current content item, i.e. "first_draft", "published_with_draft", "hidden_with_draft", "trashed_with_draft", "published", "hidden" or "trashed".

ze::$userId

When a visitor has created a user account and has logged into the site, this will hold their user id.

ze::$visitorVersion

This contains the published version of a content item - i.e. the version that a visitor would see.

Note that if a content item is not published it will not have a visitor version.