Skip to content
Search

Template processor

lastmod 2024-03-15created 2018-06-153 edits

A template processor, template engine, or template parser is software designed to combine a data model with templates to produce result documents. The language in which templates are written is called a template language.

A template processor (also known as a template engine, template parser or template language) is software or a software component that is designed to combine one or more templates with a data model to produce one or more result documents. For purposes of this article, a result document is any kind of formatted output, including documents, web pages, or source code, either in whole or in fragments.

System elements

All template processing systems consist of at least these primary elements:

  • an associated data model;
  • one or more source templates;
  • a processor or template engine;
  • generated output in the form of result documents.
Data model.
This may be a relational database, a source file such as XML, an alternate format of flat file database, a spreadsheet or any of other various sources of preformatted data. Some template processing systems are limited in the types of data that can be used. Others are designed for maximum flexibility and allow many different types of data.
Source template.
Source templates are traditionally specified:
  • according to a pre-existing programming language;
  • according to a specially-defined template language;
  • according to the features of a hosting software application; or
  • according to a hybrid combination of some or all of the above.
Template engine.
The template engine is responsible for:
  • connecting to the data model;
  • processing the code specified in the source templates; and
  • directing the output to a specific pipeline, text file, or stream
Additionally some template engines allow additional configuration options.
Result documents.
These may consist of an entire document or a document fragment.

See also

Favorite site

author Zer0 sitemap