Global Variables

There are two primary global variables injected into your templates.

The entry global#

The entry global variable is injected into your templates whenever a request to Enact matched a entries URL (this global will not exist if the the request was not matched directly to an entry, see the Routing Docs for other ways requests are resolved). The entry global is an instance of an Entry Wrapper. It provides the properties of the matched entry, access to the fields used by the entry accessed directly by the fields handles, and helper methods which allow for printing and searching. See the Entry Wrapper docs for full information for using the entryglobal.

The enact global#

The enact global encapsulates functionality and access to services and variables provided by enact. The methods provided by it are wide ranging, below we will detail them.


Get the site name as defined in the general settings.

<h1>Welcome to {{ enact.siteName }}, enjoy your visit!</h1>

Get the site logo as defined in the general settings.

{{ enact.siteLogo }}

Get the site icon (favicon) as defined in the general settings.

{{ enact.view.favIcon( enact.siteIcon.url ) }}

Access the global fields established in the globals tab of Enact.

<div>Call us at {{ enact.globals.phoneNumber }}</div>

Get the FQDN of the site.

<a href='{{ enact.siteUrl }}/about-us'>About {{ enact.siteName }}</a>

Get the URL that users login to Enact at.

<a href='{{ enact.loginUrl }}'>Login</a>

Get the URL that users logout of Enact at.

<a href='{{ enact.logoutUrl }}'>Logout</a>

Get the currently logged in user, if no user the returned value is null, otherwise returns a User Wrapper.

{% if enact.currentUser %}

    <div>{{ enact.currentUser.displayName }}</div>

    {{ enact.currentUser.getImgHtml }}

{% endif %}

Get a current configuration settings

{% if enact.config('devMode') %}

// running in dev mode

{% endif %}

Get a PHP DateTime object set to the current time.

<div>Current UNIX : {{ }}</div>

Force the request to exit, literally calling exit in PHP.

{{ enact.quit }}

Perform a “dump and die” on a variable. Use this for inspecting things.

{{ enact.dd( entry ) }}

Get a plugins template class.

{% set SomePlug = enact.plugin.PluginName %}

{{ SomePlug.method }}

Get the value of the current users CSRF token.

CSRF value : {{ enact.csrfTokenValue }}

Get the name of the current users CSRF token.

CSRF name : {{ enact.csrfTokenName }}

Get a hidden input for use in forms that provides the CSRF token name/value.

{{ enact.csrfTokenInput }}


which is equivalent to performing
<input type='hidden' name='{{ enact.csrfTokenName }}' value='{{ enact.csrfTokenValue }}'/>


Fetch a RSS feed.

enact.rss('url', limit, offset, cacheDuration)


  • url (string) - The url to the RSS feed.

  • limit (null | integer) - The maximum number of items returned in the feed, if not provided or null, the entire feed will be returned.

  • offset (null | integer) - The offset of the items to return, if not provided or null, items starting from 0 index will be returned.

  • cacheDuration (null | integer | string) – The amount of time to cache the request for, if not provided or null, the feed will be cached for the amount of time defined by the configuration setting cacheDuration. If you provide an integer it will be cached for that number of seconds. You can also provide a string like +30 minutes, +1 hour, +1 day.

{% set feed = enact.rss('') %}

<h1>{{ feed.title }}</h1>

<a href='{{ }}'>{{ feed.description }}</a>

{% for item in feed.item %}

    <a href='{{ }}'>{{ item.title }} - {{ item.pubDate }}</a>

{% endfor %}

Sub Services#


Access the current view class, which provides tons of helper methods for building your templates.

See View Docs.


Access the request class, which provides information about the current request.

See Request Docs.


Access the session class, which provides information on the current session.

See Session Docs.


Access the cache class, which provides the ability to manage cached data.

See Cache Docs.