Tuesday, August 28, 2007

60+ template engines for JAVA, PHP and .NET

Template engines are designed to allow the separation of business logic from the presentation layer, which means allowing MVC architecture to the developers. With the aid of template engines, we are able to develop websites with different looks but the same logic or the core code. Template engines are lately known as not good ideas because recent platforms already have embedded template engines to separate views from logic, generate code etc... As you see there are very few template engines in .NET and Java comparing to the PHP. But they are still pretty useful tools for developers.

Java
  • The Apache Velocity Engine - a free open-source templating engine. Velocity permits you to use a simple yet powerful template language to reference objects defined in Java code. It is written in 100% pure Java and can be easily embedded into your own applications
  • StringTemplate - a java template engine (with ports for C# and Python) for generating source code, web pages, emails, or any other formatted text output. StringTemplate is particularly good at multi-targeted code generators, multiple site skins, and internationalization/localization.
  • FreeMarker is a "template engine"; a generic tool to generate text output (anything from HTML to autogenerated source code) based on templates. It's a Java package, a class library for Java programmers. It's not an application for end-users in itself, but something that programmers can embed into their products. Integrates with servlets, XML, Python and more
  • JBYTE - JavaBY Template Engine is a general template engine used for generating any type of text document from a template. JavaBY Template Engine is used mostly for generating HTML from servlets but it can also be used for generating XML, RTF, WML, e-mail text, source code and configuration files.
  • Jamon - a text template engine for Java, useful for generating dynamic HTML, XML, or any text-based content. Jamon clearly is aimed at the View (or presentation) layer. It has a rich feature set to support encapsulation, parameterization, functional decomposition, and reuse of presentation logic.
  • Tea is a simple yet powerful template language. Tea is most commonly used for creating dynamic web pages in the TeaServlet. Tea is a strongly typed, compiled programming language, designed to work within a Java-based hosting environment. Tea is designed to enforce a separation between data acquistion and presentation, without sacrificing basic programming constructs.
  • JDynamiTe is a simple yet powerful tool used to create dynamic documents from "template" documents. It is based on the same concept as those of "FastTemplate", which is a very popular PHP extension used in many Web sites to create dynamic HTML pages. Note: JDynamiTe is not a Java port of FastTemplate.
  • BTE (Better Templates for Everyone) - A template system designed to make the creation of web sites easier.
  • Jxp (Java scripted page) is a script-processor that process JSP-like files. It contains a parser to parse the script file into an abstract syntax tree and a tree processor (JxpProcessor) that will process the syntax tree to execute the code using reflection API to produce output.
  • SiteMesh - a web-page layout and decoration framework and web- application integration framework to aid in creating large sites consisting of many pages for which a consistent look/feel, navigation and layout scheme is required.
  • LSP is an advanced web template language based on XML technology. LSP provides powerful and easy to use presentation logic, but keeps business logic and technical details out of templates. LSP is compiled into Java bytecode for efficient execution.
  • Dynamator - a simple but powerful tool that transforms standard HTML and XML files into server pages or programs. Dynamator works with any page generation technology, including JSP, XSL, PHP, ASP, Velocity, Cold Fusion, and Java. Dynamator is compatible with any application architecture, and has no performance impact.
  • Jtpl - a template engine for Java Servlet which allows you to store your HTML code apart from your Java code.
  • Bluprints - a JSP templating framework that provides a simple and powerful alternative to Tiles and other frameworks. JDK 1.5 is required to run Bluprints.
  • WebMacro - more effective for rendering web pages than JavaServerPages, PHP, and ASP. We say this because, since 1999, programmers around the world have used both and universally endorsed WebMacro.
  • Canvas - a template generator based on the Groovy language. It uses the familiar Velocity Java API to bind variables and allows you to use the full expressivity of Groovy inside your templates.
  • IKAT - the purpose of IKAT is to establish a complete separation between presentation and business logic.
.NET
  • Asp.NET HTML Template Engine - create HTML templates for your ASP.NET application. Multiple template regions can be defined; you are no longer restricted by the usual header / footer templates.
  • NVelocity - a .Net-based template engine. It permits anyone to use the simple yet powerful template language to reference objects defined in .Net code.
  • Netro - a .Net-based template engine. It allows the use of simple yet powerful template language to reference objects defined in .Net code.
  • Evolve MasterPages - a powerful template engine which allows you to merge the contents of your ASP.NET web forms with a Master Page (template). It's very easy to use and provides full designer support. It's extremely easy to use and provides full designer support. The engine provides a new approach regarding the separation of ASP.net templates and webforms and makes it extremely easy to get your templates working. It prevents you from scattering additional HTML all over your web application and enforces a clean separation of design and development.
  • StringTemplate.NET - an idiomatic C# implementation of the Java StringTemplate Library. It runs on C#/CLI platforms such as Microsoft .NET, Novell Mono and dotGNU. StringTemplate.NET is a template engine for generating formatted text output. Examples of such output includes source code, web pages and emails. It differs from most other template engines by [more] strictly enforcing Model-View separation.
PHP
  • Smarty - a template engine that compiles the templates into PHP scripts, then executes those scripts. Very fast, very flexible.
  • web.template - new template system, works only with PHP5, uses XML-like look language, and you can call for templates method in your classes.
  • XTemplate - a cool templating engine for PHP, allows you to store your HTML code separately from your PHP code (as opposed to compiling your template into PHP as per Smarty etc.). It has many useful features such as nested blocks and various kinds of variable interpolation, and yet the code is very short and very optimized.
  • Open Power Template - a template engine written in PHP, and probably the one, which natively supports PHP 5. While developing it we chose two main goals for it: to be fast, and to be flexible. OPT uses a very effective template parsing algorithm, which compiles the templates into the PHP code.
  • FryPHP - very young, fast and easy to learn templating engine/system for PHP5, written in object oriented manner using test driven development (TDD), allows local variables for each template, you also can set global variables.
  • Template Class - very easy to use yet powerful and quick template engine. It can handle simple variable replacement and table building using two dimensional arrays and/or MySQL result sets. Performance is excellent. Has support for multiple template files. Documentation is included in the zip file.
  • Template Lite - written under PHP 5 and is currently being written under PHP 5.2.1 with E_STRICT enabled. Template Lite works without error under all versions of PHP 5 from 5.1.3 and higher. Before PHP 5.1.3 VAR would give a warning notice under E_STRICT. Template Lite works under PHP 5 without any errors but does not use any PHP 5 specific attributes.
  • PHPTAL - a XML/XHTML template library for PHP. Some PHPTAL advantages and features; enforce the separation between logic and presentation, no more htmlentities, quite clean and readable templates, ability to insert sample text inside template to preview template result without PHP backend, integrates quite well with WYSIWYG HTML editors, data abstraction using xpath like system, cool html macro system, integrated internationalization system, ability to replace xpath system with php expressions, nearly no speed loss, and template source filter interface
  • Savant - a powerful but lightweight object-oriented template system for PHP. Unlike other template systems, Savant by default does not compile your templates into PHP; instead, it uses PHP itself as its template language so you don't need to learn a new markup system.
  • YATS - seeks to preserve FastTemplate features while improving on usability and speed. It is not a direct port of FastTemplate, as it adds/removes some features, changes the syntax, and simplifies a few things, such as template definition.
  • Simple Turtle PHP Template - a simple, small, fast and quick to use function that helps separate between the logic and presentation layers in PHP programs. It is simple because all it does is string replacements, for both single words and in blocks.
  • Templeet is an open-source project initiated by Pascal Courtois and Fabien Penso. It allows you to create photo galeries, news systems, personal sites, blogs, etc. Using Templeet, you can generate HTML, CSS, SVG pictures, SMIL, and any kind of text files.
  • Enzyme - simply put, is an engine for storing structured data for structured searching.
  • Bleetz - a revolutionary templates parser based on XML generating PHP. It translates Bleetz control tags into universal php code. It is designed to be fully integrated with Macromedia Dreamweaver.
  • SSTP (Server-Side Template Parser) - powerful tool for formatting pages based on templates. It will work with virtually any HTML/XHTML page, and has support for advanced features such as syndication of content and intelligent link correction.
  • VOOT (Vanilla Object Oriented Templates) - a simple ('vanilla') PHP class for creating web pages with templates. It supports user-defined HTTP headers, and it is capable of processing PHP contained in rendered templates.
  • ecTemplate - quit making dirty HTML pages. Separate your PHP code from your HTML. Finally that graphic designer will talk to you again ;)
  • phemplate - simple and fast templating engine for php. it provides a way of substituting variables into text templates and do some dynamic block functionality including loops.
  • Yapter is a PHP template engine. Other template engines all lacked some kind of functionality for me to just like them 100%.
  • ETS - easy template system - a template system written with PHP that enables you to transform a set of data to any type of document.
  • PatTemplate is a template system that gives us the power and flexibility to add templates to our PHP driven sites.
  • Qtpl - intended for use in CGI scripts. The library will be released in 6 versions: Plain Perl, Plain PHP, C version, PHP/C module, Perl/XS version, C++ version. All of them will support uniform syntax.
  • SledgeHammer - a template engine for PHP. It provides separation of business-logic and presentation in web-based applications.
  • PHPService is a powerful template engine based on an easy-extensible XML-Metalanguage.
  • Virtual Template - class for PHP4 & PHP5 (french)
  • SimpleT - An HTML Compiler
  • AvanTemplate - is a template engine for PHP. It is multi-byte safe and consumes little computing resource. It supports variable replacement, block that can be set to hidden or shown, loop, multple-depth loop, and include statement in template file.
  • TemplatePower - offers you the ability to separate your PHP code and your (HTML) layoutfile. It's simular to the popular template class FastTemplate, but than a lot faster (about 6x faster).
  • htmltmpl: templating engine - A templating engine for Python and PHP. Provides web application developers, who need to separate the program code and the design (HTML code) of their web application projects, with a templating tool that can easily be used by cooperating webdesigners with no programming skills.
  • MiniTemplator - compact template engine for HTML files. It features a simple syntax for template variables and blocks. Blocks can be nested.
  • Layout Solution - simplifies website development and maintenance. It holds commonly used variables and page elements, allowing you to focus on designing your pages rather than worrying about correctly duplicating common layouts over and over.
  • TinyButStrong - a library that enables you to create HTML pages dynamically. It enables you to easily display information from your database, but also to seriously harmonize and simplify your PHP programming. TinyButStrong is oriented to HTML but not specialized to Html. This means it can work as well with Text files, XML, RSS, RTF, WML, Excel (xml), ...
  • WACT - a template engine that separates code from design.
  • bTemplate - small and fast template class that allows you to separate your PHP logic from your HTML presentation code.offers you the ability to separate your PHP code and your (HTML) layoutfile. It's simular to the popular template class FastTemplate, but than a lot faster (about 6x faster).
  • QuickTemplate - a PHP extension for mananging templates and performing multi level variable and block interpolation.
  • VarPage - very simple PHP class for building websites based on Template files
  • FastTemplate - PHP extension for mamanging templates and performing variable interpolation, robust and flexible, and allows you to build very complex HTML documents/interfaces. It is also completely written in PHP and (should) work on Unix or NT.
  • Vemplator is PHP template engine that strives to be light-weight yet featured, and does quite well in only 200 lines of code. The template syntax is concise, and the code is written to be extensible. Though it may be somewhat strict (doesn't allow function calls from the template, among other things) it's very usable. The strictness is intended to constrain the template logic to that which relates to presentation.
See Also;

2 comments:

Anonymous said...

I used Dwoo for a recent PHP project and I must say I was impressed. The templating syntax looks a lot like Django's (Python) own templating syntax, and I like it :) It's new but seems already quite mature.

Anonymous said...

Just a note that Open Power Template has changed domain to http://www.invenzzia.org/, has been rewritten from scratch, it is not the only one that supports PHP5 and it is now based on XML and focuses on declarative programming.