Contact Us
Python BlogDjango BlogBig DataSearch for Kubernetes AWS BlogCloud Services



How to use Variables in Diazo

November 13, 2014

Variables can be used in your Diazo rules.xml from TAL expressions set in your theme. These variables are defined in your theme's manifest.cfg like so:

portal_url = portal_state/portal_url
ajax_load = python: 'ajax_load' in request.form
anon_user = portal_state/anonymous

These are some commonly used variables. Just like TAL, they use path expressions by default, but python: or string: can be specified.Diazo concept graphic

If the parameters were set directly in the manifest.cfg, you will need to reactivate the theme in the Theming control panel (deactivate, then activate). The parameters can also be set in the control panel's Advanced Settings tab. Available variables that can be used within the expressions are context, request, portal, portal_state, and context_state.

Use in rules.xml

Use variables prefixed with $. If used in HTML within a rule, the variable also needs to be wrapped in curly braces:

<drop css:content="#portal-breadcrumbs"

<replace css:theme="#sitesearch">
  <form action="{$portal_url}/@@search" method="post">

Simple condition expressions can also be done in the rules using the variables:

<drop css:theme=".manageLink"
      if="$role != 'administrator'"/>


I hope this gives you a brief understanding of how to apply variables in your Diazo theme. You can learn more at and also find more training like this one at

Like what you've read? Be sure to sign up for our weekly Plone & Python How-To digests.

Tell us about the goals you’re trying to accomplish.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.