home > support > web design > element tags
Element tags
Element tags represent individual data items. All element tags have a $ sign to act as a reminder that they act in the same way as software variables. A complete element tag looks like:
<$TourCMSdeparture d_id="3" output="d_code"$>
The d_id and output are attributes. They define exactly what content should be returned to the screen.
Context & container tags
As we have seen, the primary element tags (TourCMSoption, TourCMStour, TourCMSdeparture, TourCMSfreesale, TourCMScollection) all require the internal ID to be known in order to display data (such as d_id and t_id). This can be useful if we want to specifically list some content on a page but generally we don't want to go to the hassle of looking up all the IDs for the content that we want to display.
Instead, page context and container tags are used.
In the introduction to tags article we looked at how container tags can combine with element tags, as below:
<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>
The key point to note from the example above is that neither the TourCMStour nor the TourCMSdeparture element tags have an ID. This is because the ID is automatically allocated to element tags that are contained within the TourCMSlist_departures container tag. In fact the TourCMSlist_departures tag allocates a d_id ID to all element tags within it (that can make use of it).
Page context
The second type of context is page context. This occurs with the two tour templates (tour & tour dates & prices) and the collection page template. On these pages we no longer need to set context using a container tag - but context is automatically set for the specific tour or collection. Again therefore we do not need to go looking up all the ID information to pull content to these pages.
- Tour template -> sets t_id
- Dates & prices template -> sets t_id
- Collection template -> sets c_id
XML safe
To make content from an element tag safe to use within an XML file (such as an RSS feed) add xml="1" as an additional attribute. This will ensure that quotes and other harmful characters will be replaced with their corresponding entities.
HTML entities
By default content that is edited within textareas (in TourCMS) will, when generated by TourCMS, be sent to you website using HTMLENTITIES.
However, if you are looking to, for example, embed some flash (or other HTML markup) within your content, this will not come out right. (The code itself will be shown on the screen - rather than the output of the code).
In these situations turn off HTML Entities by using html_ent="0" as an additional attribute.
Secure images and documents via Https
To make content from an element tag swap image sources (src) and document links to https (rather than http) add https_content="1" as an additional attribute. This works for normal, tour, option & collection content. Generally on your own website you will want image source calls to be insecure (http) (which is the default if the attribute not supplied) and to be secure during the online booking process.
Content called via live tags is always secured using Https.
Programming logic
Some element tags return with data such as 1 or 0. These are not intended for direct display to the screen but for use in custom, server side, development. In PHP, variables can be set as follows:
<?
$title = "<$TourCMStour t_id="20" output="t_name"$>";
?>
The two sets of quotes may look like they conflict but by the time PHP sees the page, the element tag has been replaced with the tour name. (Alternative programming languages, such as ASP.NET, JSP etc can be used on your own webhosting)
Further information
|