Retired Documentation: You are using the documentation for version 1.7.3 which was retired in 2013. Go here for the latest version documentation or check here for your available upgrades to the latest version.
Standard Global Variables
These Global Variables can be used anywhere within your Templates.
- {app_build}
- {app_version}
- {charset}
- {current_time format="%Y %m %d %H:%i:%s"}
- {debug_mode}
- {elapsed_time}
- {email}
- {embed='news/local'}
- {[email protected]}
- {group_id}
- {group_title}
- {gzip_mode}
- {hits}
- {homepage}
- {ip_address}
- {lang}
- {location}
- {member_group}
- {member_id}
- {member_profile_link}
- {redirect='news/local'}
- {screen_name}
- {site_name}
- {site_url}
- {template_edit_date format="%Y %m %d %H:%i:%s"}
- {total_comments}
- {total_entries}
- {total_queries}
- {username}
- {webmaster_email}
- {XID_HASH}
Please note that there is an alternative syntax for member variables that may be used in situations where an naming conflict with a module's variables may occur.
app_build
{app_build}
The build of ExpressionEngine that you are using (20070302, 20070328, etc.).
app_version
{app_version}
The version of ExpressionEngine that you are using (1.3, 1.4, etc.).
charset
{charset}
This variable will be substituted for the global character set preference under Admin > Control Panel Settings. It is typically used in your META tags to indicate the character encoding:
<meta http-equiv="Content-Type" content="text/html; charset={charset}" />
If you wish to use the character encoding you have specified for a particular weblog (in the Control Panel Admin > Weblog Management page) you may use the Weblog Information EE Tag instead.
current_time
{current_time}
This variable displays the current server time localized to each user's particular setting. As with other date variables, you will use the standard date variable formatting:
{current_time format="%Y %m %d %H:%i:%s"}
NOTE: Unlike the rest of the Standard Global Variables, {current_time} is parsed very early on in the Template parser, which allows you to make dynamic use of it in your tags, for instance as a tag parameter, or in a conditional.
debug_mode
{debug_mode}
This variable will be substituted with either "on" or "off" based on your debug mode settings.
elapsed_time
{elapsed_time}
The amount of time, in seconds, it took ExpressionEngine to render the current page.
{email}
The email address for the currently logged-in user.
embed
{embed='news/local'}
This variable allows you to embed one Template within another. Please see the Embedded Templates section.
encode
{encode="[email protected]" title="Email Me!"}
This variable will encode the specified email address using javascript and HTML entities to make it more difficult for spam harvesters to grab an email address from your site. If you normally show your email address on your site you are encouraged to use this variable. The title parameter on the variable allows you to specify the text you want to use for the link.
Email Me!
group_id
{group_id}
The Member Group ID number for the currently logged-in user.
group_title
{group_title}
The title of the member group for the currently logged-in user.
gzip_mode
{gzip_mode}
This variable will be substituted with either "on" or "off" based on your output compression settings mode settings.
hits
{hits}
This variable will be substituted with the number of hits that any given template containing the variable has received.
homepage
{homepage}
This variable will be substituted with the URL to your home page as defined under Admin > General Configuration.
ip_address
{ip_address}
This variable will be substituted with the IP address of the currently logged in user.
lang
{lang}
This variable will be substituted for the "Default XML Language" preference as defined under Admin > General Configuration.
location
{location}
The location (as entered in their profile) for the currently logged-in user.
member_group
{member_group}
The Member Group ID number for the currently logged-in user.
member_id
{member_id}
The Member ID for the currently logged-in user.
member_profile_link
{member_profile_link}
This variable will be substituted with a link to the public profile page for the currently logged in user. The text of the link will be the member's screen name. For instance, the output might be:
<a href="http://example.com/index.php/member/1/">Joe Smith</a>
redirect
{redirect='news/local'}
This variable allows you redirect the visitor to another template. Typically this will mean that you will be utilizing the tag within conditionals.
{if segment_3 != 'cookies'}>
{redirect='bake/cookies'}
{/if}
You can also use the redirect variable to provide tighter control of your URLs, and trigger 404 pages in certain conditions. When you want to display your 404 page, just use "404" for the template. For instance, you might do this on a template group's 'index' template that you do not wish to be displayed if an arbitrary second URL segment exists.
{if segment_2 != ''}
{redirect="404"}
{/if}
Be careful that through your redirect variables that you do not create an infinite loop.
screen_name
{screen_name}
The screen name for the currently logged-in user.
site_name
{site_name}
This variable will be substituted with your site name as defined under Admin > General Configuration.
site_url
{site_url}
This variable will be substituted with your site URL as defined under Admin > General Configuration.
template_edit_date=""
This variable displays the localized time for when the template was last updated. As with other date variables, you will use the standard date variable formatting:
{template_edit_date format="%Y %m %d %H:%i:%s"}
total_comments
{total_comments}
The total number of comments posted by the currently logged-in user.
total_entries
{total_entries}
The total number of entries posted by the currently logged-in user.
total_queries
{total_queries}
The total number of database queries used to generate the current page.
username
{username}
The username for the currently logged-in user.
webmaster_email
{webmaster_email}
{encode="{webmaster_email}" title="Contact Us"}
The email address for the site, as specified in Email Configuration.
XID_HASH
{XID_HASH}
This variable is a required value for hidden form field 'XID' used in secure forms.
Alternative Syntax
In order to be able to use some member variables inside tags that already parse their own member information, such as the weblog entries tag, it is necessary to use an alternative syntax. All of the member variables may be used with the addition of the prefix "logged_in_".
{exp:weblog:entries weblog="default_site"}
This article was written by: {screen_name}<br />
The currently logged in user is: {logged_in_screen_name}
{/exp:weblog:entries}
A list of the available member variables that utilize this alternate syntax follows:
- logged_in_member_id
- logged_in_group_id
- logged_in_group_description
- logged_in_username
- logged_in_screen_name
- logged_in_email
- logged_in_ip_address
- logged_in_location
- logged_in_total_entries
- logged_in_total_comments
- logged_in_private_messages
- logged_in_total_forum_topics
- logged_in_total_forum_replies
- logged_in_total_forum_posts