All Topics  
Template engine

 
Template Engine

   Email Print
   Bookmark   Link






 

Template engine



 
 
A (web
World Wide Web

The World Wide Web is a very large set of interlinked hypertext documents accessed via the Internet. With a Web browser, one can view Web pages that may contain writing, s, videos, and other multimedia and navigate between them using hyperlinks....
) template engine is software that is designed to process web template
Web template

A web template is a tool used to Separation of concerns content from presentation in web design, and for mass-production of web documents. It is a basic component of a web template system....
s and content information to produce output web document
Web document

Web document is a similar concept to web page, except it is a broader termwith the following distinctions: ...
s. It runs in the context of a template system
Web template system

A Web template system describes the software and methodologies used to produce web pages and for deployment on websites and delivery over the Internet....
.

late engines typically include features common to most high-level programming languages, with an emphasis on features for processing plain text
Plain text

In computing, plain text is a term used for an ordinary "unformatted" sequential file readable as textual material without much processing.The Character encoding has traditionally been either ASCII, one of its many derivatives such as ISO/IEC 646 etc., or sometimes EBCDIC....
.

Such features include:

accompanying illustration depicts a simplified processing model for a typical web template engine.






Discussion
Ask a question about 'Template engine'
Start a new discussion about 'Template engine'
Answer questions from other users
Full Discussion Forum



Encyclopedia


A (web
World Wide Web

The World Wide Web is a very large set of interlinked hypertext documents accessed via the Internet. With a Web browser, one can view Web pages that may contain writing, s, videos, and other multimedia and navigate between them using hyperlinks....
) template engine is software that is designed to process web template
Web template

A web template is a tool used to Separation of concerns content from presentation in web design, and for mass-production of web documents. It is a basic component of a web template system....
s and content information to produce output web document
Web document

Web document is a similar concept to web page, except it is a broader termwith the following distinctions: ...
s. It runs in the context of a template system
Web template system

A Web template system describes the software and methodologies used to produce web pages and for deployment on websites and delivery over the Internet....
.

Typical features

Template engines typically include features common to most high-level programming languages, with an emphasis on features for processing plain text
Plain text

In computing, plain text is a term used for an ordinary "unformatted" sequential file readable as textual material without much processing.The Character encoding has traditionally been either ASCII, one of its many derivatives such as ISO/IEC 646 etc., or sometimes EBCDIC....
.

Such features include:
  • variables and functions
  • text replacement
  • file inclusion (or transclusion
    Transclusion

    In computer science, transclusion is the inclusion of part of a document into another document by reference. It is a feature of Web template....
    )
  • conditional evaluation and loops
    Control flow

    In computer science control flow refers to the order in which the individual statement , Instruction or function calls of an imperative programming or functional programming computer program are execution or evaluated....


Example

The accompanying illustration depicts a simplified processing model for a typical web template engine. The template engine produces a web page by processing the web template source file along with data from a relational database
Relational database

A relational database is a database that groups data using common attributes found in the data set. The resulting "clumps" of organized data are much easier for people to understand....
. The template engine replaces variables with specific values. In the illustration, substitution of $X by the database content (in page 01 "Mother", on page 02 "World").

A web template
Web template

A web template is a tool used to Separation of concerns content from presentation in web design, and for mass-production of web documents. It is a basic component of a web template system....
 might look like this:


   

Hello

With additional template source code ...

templateAssign ('X', 'World');
... or, when specifying the relational database context:

$data[01]='Mother';  $data[02]='World';
templateAssign('X', $data[$i]);


Benefits

Benefits of using template engines include:
  • Encouraging organization of source code into operationally-distinct layers (see e.g., MVC
    Model-view-controller

    Model?View?Controller is an Architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other....
    )
  • Enhancing productivity by reducing unnecessary reproduction of effort
  • Enhancing teamwork by allowing separation of work based on skill-set (e.g., artistic vs. technical)


Comparison


The following table lists the various template engines discussed on Wikipedia and a brief rundown of their features. The content here is a work-in-progress.

Engine (Implementation) Languages License Platform Variables Functions Includes Conditional Inclusion Looping Evaluation (Language) Assignment Errors & Exceptions
StringTemplate Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
 (native), Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
, C#
open-source? Cross-Platform
ASP.net
ASP.NET

ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services....
 (Microsoft)
C#, VB.net Proprietary Microsoft Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
 
ASP.net
ASP.NET

ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services....
 (Mono)
C# GNU LGPL Cross-Platform
Apache Velocity Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
, C#
Apache License
Apache License

The Apache License is a free-software license authored by the Apache Software Foundation . The Apache License requires preservation of the copyright notice and disclaimer, but it is not a copyleft license — it allows use of the source code for the development of free software and open source software as well as proprietary software....
 
Cross-Platform
PHP 5 GNU LGPL Cross-Platform
CheetahTemplate
CheetahTemplate

Cheetah is a template engine that uses the Python . It can be used standalone or combined with other tools and frameworks. It is often used for server-side scripting and dynamic web content by generating HTML, but can also be used to generate source code....
 
Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
 
MIT License
MIT License

The MIT License is a free software license originating at the Massachusetts Institute of Technology , used by the MIT X Consortium.It is a Permissive_free_software_licence license, meaning that it permits reuse within proprietary software on the condition that the license is distributed with that software....
 
Cross-Platform
Chip Template Engine
Chip Template Engine

Chip is a template engine written for use with both PHP and Perl. It is designed to provide both the programmer with a flexible toolset for quick HTML parsing and output, and the designer with a simple parsing control syntax....
 
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
, Perl
Perl

In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language....
 
open-source? Cross-Platform
CTPP
CTPP

CTPP is a template engine completely written in C++. It has bindings for Perl, PHP and Python languages....
 
C
C (programming language)

C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
, C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
, Perl
Perl

In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language....
, PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
, Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
 
BSD-like Cross-Platform
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 5
GNU LGPL Cross-Platform (PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
)
Dylan Server Pages
Dylan Server Pages

Dylan Server Pages is a template engine for providing dynamic web site content using the Dylan language. They are similar in spirit to JavaServer Pages, but without the ability to mix program logic and page content....
 
Dylan language unknown unknown ?
eRuby
ERuby

eRuby is a templating system that embeds Ruby programming language into a text document. It is often used to embed Ruby code in an HTML document, similar to Active Server Pages, JavaServer Pages and PHP....
 
Ruby
Ruby (programming language)

Ruby is a dynamic programming language, reflection , general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features....
 
open-source? Cross-Platform
Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
, Py3K
AFL v3.0 Cross-Platform (Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
)
FreeMarker
FreeMarker

FreeMarker is a Java -based template engine focusing on the Model-view-controller software architecture. Although it's mostly used for Servlet-based Web Application development, it can be used for any other kind of text output, such as generating CSS, Java source code, etc....
 
Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
 
BSD-like Cross-Platform
Genshi (templating language)
Genshi (templating language)

Genshi is a template engine for XML-based vocabularies written inPython . Genshi is used to easily insert generated output into XML-based languages, usually HTML, and reuse elements between documents....
 
Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
 
BSD-like Cross-Platform (Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
)
Groovy Apache License
Apache License

The Apache License is a free-software license authored by the Apache Software Foundation . The Apache License requires preservation of the copyright notice and disclaimer, but it is not a copyleft license — it allows use of the source code for the development of free software and open source software as well as proprietary software....
 
Cross-Platform (Groovy)
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
, Ruby
Ruby (programming language)

Ruby is a dynamic programming language, reflection , general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features....
MIT License
MIT License

The MIT License is a free software license originating at the Massachusetts Institute of Technology , used by the MIT X Consortium.It is a Permissive_free_software_licence license, meaning that it permits reuse within proprietary software on the condition that the license is distributed with that software....
 
Cross-Platform
Haml
Haml

Haml is a markup language that is used to cleanly and simply describe the XHTML of any web document without the use of traditional inline coding....
 
Ruby
Ruby (programming language)

Ruby is a dynamic programming language, reflection , general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features....
, PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 (WIP)
MIT License
MIT License

The MIT License is a free software license originating at the Massachusetts Institute of Technology , used by the MIT X Consortium.It is a Permissive_free_software_licence license, meaning that it permits reuse within proprietary software on the condition that the license is distributed with that software....
 
Cross-Platform (Ruby
Ruby (programming language)

Ruby is a dynamic programming language, reflection , general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features....
)
Hamlets
Hamlets

Hamlets is the name of an open source system for generating web-pages originally developed by Ren? Pawlitzek at IBM. He defines a Hamlet as a servlet extension that reads XHTML template files containing presentation using SAX and dynamically adds content on the fly to those places in the template which are marked with special tags an...
 
Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
 
BSD Cross-Platform
JSP Weaver
JSP Weaver

JSP Weaver is a JavaServer Pages interpreter. Unlike JSP compilers it evaluates the JSP files directly, without generating or compiling intermediate Java source files for the JSP Java servlet....
 
Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
 
Proprietary Cross-Platform
Jasper framework
Jasper framework

The Jasper framework is an open source, cross platform web development framework. It is often simply referred to as Jasper....
 
Perl
Perl

In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language....
, PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
, C#, Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
 
open-source? Cross-Platform
JavaServer Pages
JavaServer Pages

JavaServer Pages is a Java technology that allows software developers to create dynamic web page, with HTML, XML, or other document types, in response to a Web client request....
 
Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
 
Proprietary Cross-Platform
Jinja
Jinja (Template engine)

Jinja is a template engine for the Python . It's similar to the Django template engine but provides python like expressions while ensuring that the templates are evaluated in a Sandbox ....
 
Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
 
BSD Cross-Platform (Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
)
Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
 
BSD-like Cross-Platform Through inheritance
Kid (templating language)
Kid (Templating Language)

Kid is a simple template engine for XML-based vocabularies written in Python . Kid claims to have many of the best features of XSLT, Template Attribute Language, and PHP, but "with much of the limitations and complexity stamped out"....
 
Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
 
open-source? Cross-Platform (Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
)
Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
 
MIT Cross-Platform (Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
)
Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
 
MIT Cross-Platform (Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
)
?
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
, Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
, VB.net
GNU LGPL Cross-Platform ?
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 5
GNU GPL Cross-Platform (PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
)
?
Open Power Template
Open Power Template

Open Power Template is a template engine written in PHP 5. It is used to generate dynamic web application content, like HTML or RSS , by placing the script results inside special tags, such as ....
 
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 5
GNU LGPL Cross-Platform (PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
)
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 5
open-source Cross-Platform (PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
)
?
PHAML
PHAML

pHAML is a PHP-centric variant of Haml. Haml is a markup language that is used to cleanly and simply describe the XHTML of any web document without the use of traditional inline coding....
 
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 
MIT License
MIT License

The MIT License is a free software license originating at the Massachusetts Institute of Technology , used by the MIT X Consortium.It is a Permissive_free_software_licence license, meaning that it permits reuse within proprietary software on the condition that the license is distributed with that software....
 
Cross-Platform (PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
)
?
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 5
GNU GPL Cross-Platform (PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
)
Smarty
Smarty

Smarty is a web template system written in PHP. Smarty is primarily promoted as a tool for separation of concerns, which is a common design strategy for certain kinds of applications....
 
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 
GNU LGPL Cross-Platform (PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
)
?
TinyButStrong
TinyButStrong

TinyButStrong is a template engine written in PHP. Programmers and web developers may use it for Web development. TinyButStrong is a PHP class that separates PHP from HTML....
 
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 
open-source? Cross-Platform
Vemplator PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 
MIT License Cross-Platform (PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
)
vlibTemplate
VlibTemplate

vlibTemplate is a template engine written in PHP. Programmers and web developers may use it for web development. vlibTemplate is a PHP class that is intended to make splitting PHP from HTML a simple and natural task....
 
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 
Artistic License Cross-Platform
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 
open-source Cross-Platform indirect
Template Toolkit
Template Toolkit

The Template Toolkit is a fast and flexible template engine used primarily for building web sites but also suitable for any type of digital document creation like PDF or LaTeX....
 
Perl
Perl

In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language....
 
open-source Cross-Platform (Perl
Perl

In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language....
)
WebMacro
WebMacro

WebMacro is a framework for developing Java Servlets. It enforces a Model-View-Controller framework on a project allowing for a clean separation of concerns in the design....
 
Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
 
open-source? Cross-Platform
PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 5, JavaScript
JavaScript

JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
 
MIT License
MIT License

The MIT License is a free software license originating at the Massachusetts Institute of Technology , used by the MIT X Consortium.It is a Permissive_free_software_licence license, meaning that it permits reuse within proprietary software on the condition that the license is distributed with that software....
 
Cross-Platform


See also

  • Template processor
    Template processor

    A template processor is software or a software component that is designed to combine one or moreTemplate with a data model to produceone or more result documents....
  • Layout engine
    Layout engine

    A layout engine, or rendering engine, is software that takes Markup language content and formatting information and displays the formatted content on the screen....
Category:Template engines
  • Macro preprocessor
  • Preprocessor
    Preprocessor

    In computer science, a preprocessor is a Computer program that processes its input data to produce output that is used as input to another program....
  • Smarty
    Smarty

    Smarty is a web template system written in PHP. Smarty is primarily promoted as a tool for separation of concerns, which is a common design strategy for certain kinds of applications....
     (PHP: Template engine)
  • Mytemplate (PHP: MyTemplate engine)
  • vlibTemplate
    VlibTemplate

    vlibTemplate is a template engine written in PHP. Programmers and web developers may use it for web development. vlibTemplate is a PHP class that is intended to make splitting PHP from HTML a simple and natural task....
     (PHP: Template engine)
  • Jasper framework
    Jasper framework

    The Jasper framework is an open source, cross platform web development framework. It is often simply referred to as Jasper....
  • Virtual machine
    Virtual machine

    In computer science, a virtual machine is a software implementation of a machine that executes programs like a real machine.Definitions...
  • Bytecode
    Bytecode

    Bytecode is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software Interpreter as well as being suitable for further compilation into machine language....


External links