Current

This document is valid for the current version of Plone.

Global Template Variables

by Anne Bowtell last modified Apr 03, 2009 10:03 PM
Contributors: Yuri Carrer
Plone defines a few useful global variables to use them in your templates

While writing templates for Plone, you will notice a set of variables you use more often, like the URL of the portal or the currently authenticated member.

For your convenience, Plone defines a few global template variables that are pulled into main_template via global_defines. Some of the most useful ones are:

portal
The portal object.
portal_url
The url of the portal.
member
The current user (None if user is anonymous)
checkPermission
A function to check if the current user has a certain permission in the current context, e.g. checkPermission('View portal content', context).
isAnon
True if the current user is not logged in.
is_editable
True if the current user has edit permissions in the context.
default_language
The default language of the portal.
here_url
The URL of the current object.

To see the full list list of these variables, see the docstring for globalize() in the interface Products.CMFPlone.browser.interfaces.IPlone.