Template global variables

Template global variables#

For convenience Plone defines a couple of global variables often used in templates.

portal_url#

portal_url will return the portal URL. It can be used as follows:

<a href="${portal_url}/@@overview-controlpanel>Overview Controlpanel</a>

It is basically a short cut for:

<div tal:define="portal_url python: portal_state.portal_url()">
  <a href="${portal_url}/@@overview-controlpanel">Overview Controlpanel</a>
</div>

checkPermission#

checkPermission will return the checkPermission method from portal_membership tool.

It can be used as follows to check for user permissions in templates:

<div tal:condition="python: checkPermission('Modify portal content', context)">
  <span tal:omit-tag="">
    You see this page because you have permission to edit this.
  </span>
</div>