Back to index

4. Container tags

4.1 Container tags overview

Container tags repeat element tags and other enclosed content. They work like HTML container tags and must have both a start and an end tag.

The following is an example of a container tag:

<TourCMSlist_departures orderby="offer_datetime" order="desc"
bookable="show" has_offer="show" maxdisplay="3">
</TourCMSlist_departures>

By themselves container tags can't display or produce any output. They must have some enclosed content that is repeated for each new "loop". For example this container tag has 2 enclosed element tags:

<TourCMSlist_departures orderby="offer_datetime" order="desc"
bookable="show" has_offer="show" maxdisplay="3">

<$TourCMStour output="t_name"$>
<$TourCMSdeparture output="d_offer_price"$>

</TourCMSlist_departures>

Attributes
Attributes are used to define exactly what lists to create. The full list of attributes is on the container tags list page. There are no mandatory attributes.

An example attribute from above is has_offer="show". This attribute, on the TourCMSlist_departures container tag, will ensure that only tour departures that have a special offer will be listed. In combination with the bookable="show" attribute, only bookable departures with special offers will be listed.

Show and hide
Some of the attributes can be be set with show or hide. For example TourCMSlist_collections has an attribute has_page that can be either show or hide.

If it is set to show, only collections with web pages will be listed. If it is set to hide, only collections without web pages will be listed. If the has_page attribute is not used, collections that either have a page or don't have a page will be listed.

Context
The concept of context was introduced in the element tag overview.

Each container tag sets context for all content that is enclosed by its start and end. For example, TourCMSlist_tours sets the t_id (Internal tour ID) for enclosed content. We can then use any TourCMStour element tag within the TourCMSlist_tours container tag to output specific tour content.

Nesting container tags
As just explained, TourCMSlist_tours sets t_id context to all enclosed content. There are other container tags that can accept context. For example, TourCMSlist_departures, if set with a t_id, will just list departures for a specific tour. We can nest container tags as follows:

<TourCMSlist_tours>
 <TourCMSlist_departures>
    <$TourCMSdeparture output="d_code"$>
 </TourCMSlist_departures>
</TourCMSlist_tours>

This above will create a list of departures for the first tour, then all the departures for the next tour, then the next etc. For each tour, the departure code will be shown.

There are some occassions where context is not required. To stop context set the internal id (c_id, t_id, o_if, d_id, f_id) to all.

<TourCMSlist_tours>
 <TourCMSlist_departures d_id="all">
    <$TourCMSdeparture output="d_code"$>
 </TourCMSlist_departures>
</TourCMSlist_tours>

Unlike the previous example, this will, for each tour, list all departures for all tours.

Next: 4.2 Container tags, full list