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.

Weblog Entries - Variable Pairs

Variable pairs contain an opening and closing tag as well as content in-between. Example:

{date_heading}

<h1>{entry_date format="%Y %m %d"}</h1>

{/date_heading}

The reason variable pairs have an opening and closing pair is because the information between the pairs can be shown or not shown if the criteria for each tag is met.

In the case of the "date_heading" pair, for example, it only appears at a certain interval that you set (hourly, daily, weekly, monthly, etc.). By using a pair of variables you can put HTML formatting between them that only gets shown when the interval is met. Otherwise, the chunk is not displayed.

date_footer

{date_footer display="daily"}

<p>That's all from today!</p>

{/date_footer}

The date footer can be used to show a footer at certain intervals. The interval can be set to show hourly, daily, weekly, monthly, or yearly.

Display Parameter

The opening {date_footer} tag has an optional "display" parameter used to set the display interval:

{date_footer display="daily"}

Choices for the "display" parameter are:

If no parameter is specified it will default to "daily".

Note: You can use as many date_footers as you want in the same tag. There is a bit of a performance hit, however, since date parsing is the most processor intensive. Read the caching section for information on improving performance.

date_heading

{date_heading}

<h1>{entry_date format="%Y %m %d"}</h1>

{/date_heading}

The date heading can be used to show a heading at certain intervals. The interval can be set to show hourly, daily, weekly, monthly, or yearly.

When using weekly intervals, the {week_date} variable would typically be used.

{date_heading display="weekly"}Week of {week_date format="%Y %m %d"}{/date_heading}

Display Parameter

The opening {date_heading} tag has an optional "display" parameter used to set the display interval:

{date_heading display="daily"}

Choices for the "display" parameter are:

If no parameter is specified it will default to "daily".

Note: You can use as many date_headers as you want in the same tag. There is a bit of a performance hit, however, since date parsing is the most processor intensive. Read the caching section for information on improving performance.

categories

{categories}

{category_image} <a href="{path='weblog/index'}">{category_name}</a>

{/categories}

Categories are unique in that they are a "looping pair". Since you can have multiple categories per entry, we need a mechanism to show as many categories as exist for each entry.

Backspace Parameter

You can add an optional parameter that allows "backspacing":

{categories backspace="6"}

Backspacing removes characters from the last iteration of the loop. For example, if you put a <br /> tag between each category you would normally have this layout:

News<br />
Sports<br />
Politics<br />

You might, however, not want the <br /> tag after the final item. By adding backspacing you can remove it. Simply count the number of characters and spaces in the item you want to remove and add it to the tag (do not include trailing spaces in your count). A <br /> tag has 6 characters, so you would do this:

{categories backspace="6"}

{category_name}<br />

{/categories}

This would display output similar to this:

News<br />
Sports<br />
Politics

Limit Parameter

{categories limit="1"}

This parameter limits the number of categories output by this variable pair. When in use, it will limit the output to the number provided, using the specified order in the Category Management page to determine which categories get shown.

Show Parameter

{categories show="4|7"}

With this parameter, you can specify which categories can be included when listing them with the {categories} variable pair. For instance, if you had entries that belonged to several categories, you could use this parameter to limit the display to only those categories you specified. While the entries may actually belong to more categories, only those you specify would be shown. Category IDs are separated by the pipe character to specify more than one category.

You may alternatively specify which categories to not show:

{categories show="not 3|6|8"}

Show Group Parameter

{categories show_group="1|3"}

With this parameter, you can specify which category groups can be included when listing categories with the {categories} variable pair. For instance, if you had entries in a weblog that had multiple category groups but only wanted to show the categories for one of those groups, you could specify that category group's ID number with this parameter. Category Group IDs are separated by the pipe character to specify more than one category group.

You may alternatively specify which category groups to not show:

{categories show_group="not 2|4"}

{category_id}

{category_id}

The category ID associated with the category.

{parent_id}

{parent_id}

The category ID associated with the category's parent (or 0 in the case of a top level category).

{category_group}

{category_group}

The category group ID associated with the category.

{category_image}

{category_image}

The image link (or other information) you can optionally store with each category within the Control Panel.

{category_name}

{category_name}

This displays the name of the category.

{category_url_title}

{category_url_title}

This variable displays the URL title of the category

{path=''}

{path='weblog/index'}

This variable will be replaced by a URL to the specifies Template Group/Template. The category designation information will automatically be added to the end of the URL so that the target page will know which category to display.

If you want the category links to point to your site index instead of a particular template group/template you can use SITE_INDEX instead:

{categories}

<a href="{path='SITE_INDEX'}">{category_name}</a>

{/categories}

Custom Category Fields

All custom fields assigned to a category can be accessed using the "short name" of the field:

{class}
{extended_description}
{category_name_fr}
etc..

These are totally dynamic in that any field you create for your category will automatically be available by its "short name" as a variable.

Top of Page