Tables Use Templates

From HLKitWiki
Revision as of 11:43, 19 November 2008 by Rob (talk | contribs)
Jump to navigationJump to search

[Context: HL Kit … Basic Concepts and Terminology … Manipulation of Visual Elements … Working With Tables]

Overview

Tables make extensive use of templates. All of the objects shown within a table are viewed through a template. If the table is dynamic and allows items to be added, a separate template is used for displaying the items available for selection. If a table has a header or footer, then a template is used to display that information.

In fact, everything displayed as part of a table is accomplished using a template. The reason for this is simple. Using templates makes tables highly modular, allowing authors to readily customize the contents and re-use common templates for similar purposes.

How Templates Are Used

Every item shown within a table is either a thing or a pick. Every item that can be selected for addition to a table is a thing or a pick. Templates are an ideal vehicle for display within tables, since templates are always associated with a specific thing or pick. When used for showing a list of items, the same template is simply associated separately with each item in the list to properly render the contents of each item.

When rendering the table to the display, the HL engine will retrieve the list of objects that belong to the table. Then each of those objects is rendered, one at a time, into the table. For each object, the template defines the portals to be displayed and the object provides the appropriate fields from which to pull the information. Since the template is rendered separately for each item, it's perfectly reasonable to customize the contents of the template for each object. For example, certain portals can be hidden for some objects, while styles can be changes for certain portals on other objects.

The "Show" Template

Every table uses at least one template - the "show" template. This template is used to display each of the items within the table.