Template Variables
Template variables are used in templates to specify where story content will be presented on the page. For example, there is a template variable named "title" that you usually will want to place near the start of your page in a large, bold font.
Template variables are also used in template logic (conditional statements) to determine what content is displayed and how. For example, there is a template variable named "is_form" that you can use in templates to make form pages look different than static pages.
The syntax for displaying a variable is:
<tmpl_var the_variable_name>
You do not need to include "tmpl_var" when using the variable in template expressions. For example, an if expression using a template variable looks like this:
<tmpl_if the_variable_name>
Code block
</tmpl_if>
Commonly Used Template Variables
Below is a list of the most commonly used template variables. For a full list of template variables, please contact your Plus Three account manager.
- slug
- The story's slug
- title
- The story's title
The following variables related to the story's location in the category tree are also commonly used:
- section
- The top-level category the story lives in
- subsection
- The second-level category the story lives in
- subsubsection
- The third-level category the story lives in
- section_string
- All parent categories joined with _
- url_section
- The top-level category the story lives in plus the slug
- url_subsection
- The second-level category the story lives in plus the slug
- url_subsubsection
- The third-level category the story lives in plus the slug
- url_section_string
- All parent categories plus the slug joined with _
There are also several true/false variables that can be very helpful:
- is_form
- Evaluates to true if the story is a form page
- is_home
- Evaluates to true if the story is a homepage.
- is_ssl
- Evaluates to true if the story is a fundraising page (which will run over an encrypted SSL connection)
- is_story
- Evaluates to true if the story is static content, NOT a form page