Web template system (terminology)
From Wikipedia, the free encyclopedia
[edit] Article terminology
Some original terms were introduced to precisely distinguish core concepts:
- Hook: a specific kind of region delimiter used in template languages to indicate a boundary between languages.
- Template language: a resultant language of intercalation (embedding) of two languages,
- Template's output language: the formal characterization of an output language expressed in a template. All output languages may be classified as belonging one level on the Chomsky hierarchy.
- Template's script language (or template programming language): a known, named, existing domain-specific programming language generally designed for use with a web template system or a template engine. Examples include XSLT, PHP.
- Template system as a black box model:
- Process as the template engine
- Template library (a set of templates)
- Template: the formal characterization of a template T as an alternating list of output fragments, t, and script fragments, s; such that T is a grammar generated by a sequence of s's and t's.
- Content
[edit] Established terminology
- Content resource: an input supplier, like a SQL database or a XML file.
- Substitution process: the basic process of variable substitution, performed by the template engine. It finds variable names and substitute by variable values. Example (see picture above): the substitution of
$x
by the content (on page 01 by value "Mother", on page 02 by "World").- Variable and related content: the name of the variable (
$x
on the picture) and the value that it assumes (related content resource). - Moment of the substitution process: before (see "Static web template"); during (see "Server-side web template"); or after (see "Client-side web template"), the "send web document" process.
- Variable and related content: the name of the variable (
- Logic (encapsulating the substitution process): provided by more complex template languages and available only on more unrestricted template engines that interpret (parse) it. Conditionals (to decide whether to show a variable or not) and iteration (to block repetition) are the basic features to create more complex template structures.
- Output language: templating need to deal with two languages, the template language, and the output language, one embedding another. See Hook compatibility strategies section.
- Type of document: templates can be used to customize the presentation of a "standard web document" (mainly HTML documents), or to transform data into other kinds of documents, like a PDF format (see also object transformation concept). There are many types of output languages:
- Specific types: a XML schema is a typical strategy to specify the requirements of more specific type of document (than a generic format like XHTML).
- Standard formats: formats on the W3C standards for web (ex. XHTML-recommended formats).
- Non-standard types: not-W3C, but widely used on web (PDF, Flash, etc.).
- Presentation: web design and aesthetic aspects, related to the page layout, site navigability, page diagramation, page structure, and the look and feel of the proportioned web interface.
- Good separation principles: on standard documents there are two or more levels (opportunities) of "content from its presentation" separation:
- Web template: separate "pure content" from web presentation specification.
- HTML/CSS: a good use of CSS permit a more accurate separation from "content structure and grouping" (the HTML core) from "visual specification".
- Pure data and rendered data: there are "extended MVC models" like
M(VR)C
(R
stands "renderer"), where data details such as date format ("11/10/2006" or "2006-10-11" presentation) or decimal point ("1,000,000" or "1000000" presentation) need to solved without breaking the separation strategy. A classical solution is to "pre-process" the data on template engine with renderer functions. Good CSS use can also solve a lot of these cases