Go to main content

If last category

Contents

Syntax

<txp:if_last_category>

The if_last_category tag is a conditional tag and always used as an opening and closing pair, like this…

<txp:if_last_category>
    …conditional statements…
</txp:if_last_category>

The tag will execute the contained statements if the current category (usually one inside the container or form of a category_list) is the last in the currently displayed list.

Attributes

This tag has no attributes of its own. It accepts only the global attributes .

Examples

Example 1: Identify last category in a category list

<txp:category_list parent="group-1" children="0">
    <txp:if_last_category>
        <h3>
            <txp:category />
        </h3>
    <txp:else />
        <txp:category link="1" />
    </txp:if_last_category>
</txp:category_list>

Prevents the last category in the list from being hyperlinked to a category page. Why you might do it? If you nest categories under a ‘header’ category you might want to show the header of the group but not allow people to link to its category page.

Other tags used: category, category_list, else.

Genealogy

Version 4.0.7

Tag support added.

If you notice any kind of problem with this page’s construction or content (outdated information, typos, broken links, or whatever), open an issue to have it sorted. Or have a go at it yourself. :)