Displaying Categories On Your Site

There are several different ways to display category data on your web site. This section covers some of the ways you can do this.

Including Categories With Linked Content

When you output content that is linked to categories (such as calendar events), the categories that are linked to each event will automatically be included in the template data.

This data is available from the linked.categories variable in the content. For example, if you have a list of events in a variable called $content, you can access categories in the following manner.

Example 7.1. Accessing category data from a list of calendar events

{foreach from=$content item=event}
    {foreach from=$event.linked.categories item=category}
        {* output each category here *}
    {/foreach}
{/foreach}

For details about the data that is available for each category, refer to the Template Documentation widget. The Categories Listing template type lists the available data.

Outputting a List of Categories

Recite CMS includes a container rule called Categories Listing, which includes a number of different options for outputting categories.

For details on managing container rules, refer to the Administration Mode chapter.

Creating a Tagspace

Recite CMS includes a page type driver called Category Tagspace, which allows you to create a page in the context of one or more categories.

Creating pages that use this type make it possible to list out content related to only that category.

To create a tagspace, you must first create a page type using the Category Tagspace driver. Once you have created the page type you can create a tagspace page using the newly created page type.

Note

For more details about managing page types and pages, refer to the Managing Pages chapter.

For example, if you create a tagspace page with the URL value of tag, you can load the tag space for a category called music with a web site URL of /tag/music. If your music category is a sub-category of arts, the full URL would be /tag/arts/music.

You can load a tagspace of multiple categories by separating each character with the | character. For example, to load a tagspace of the categories music and movies, you can use /tag/music|movies.

Outputting Content Based on Categories

Several of the available container rules include options for filtering content by category. For example, if you add a list of calendar events to a tag space page (covered in the previous section), you can choose to include only events from the active category.

For details on managing container rules, refer to the Administration Mode chapter.