|home | news | documentation | downloads | discussion | projects | license|
There are several good reasons to use a templating system, any templating system at all. One is to allow for quick edits and changes of HTML code with out the hassle of recompiling. Template files are often very similar to HTML files, and can be editted with most HTML editors. The entire page is easy to find and edit, as opposed to finding which part of a CGI emits a particular part of the page. Using a template system also allows for faster edits/updates to the HTML. Most importantly, templates provide the ability to separate application logic from the presentation template.
Neotonic ClearSilver goes one step further than most template systems such as JSP, PHP, and ASP. Instead of allowing the separation presentation and code, it actively enforces it. There is no database connectivity, file system access, or anything of the sort available to a ClearSilver template. The templates only have access to a static dataset of strings. The dataset strings are contained in a hierarchical namespace that is populated by application code prior to the template rendering stage. This restriction is deliberate. It ensures that editing of a page template can do no work, and is thus pure presentation.
Enforcing this separation has many benefits. Debugging is simplified because it is divided into two distinct states -- debugging the application logic, and debugging of the presentation template. A website can be constructed in a truly language independent fashion. Application logic can be written in C, Python, or any other language. The templates are the glue which bring together pieces from the different languages underneath into a single UI presentation. In fact, it is easy to generate individual pages from pieces of code written in multiple languages. However, the most important benefit is that changes made to the presentation templates won't introduce bugs into the crown-jewels, the application code.
ClearSilver offers power through simplicity. Wheras XSLT requires multiple files setup to display a single page, any HTML file is a valid ClearSilver template. HTML editors can be used on the template, or the template file can even be tested in a browser without being processed. Converting an HTML mockup into ClearSilver is a simple and incremental process. Paste in the static HTML, and replace static text with ClearSilver statements one-by-one.
The inspiration for Neotonic ClearSilver, CS/HDF, has been in use on a major web application installation, with tens of millions of users and page views per day. This site constantly had code migrating from Python to C without template changes, went through 3 major presentation changes with few changes to the underlying application code, has supported over 14 countries and languages, and has simultaneously hosted separate user-interfaces off the same codebase (WAP, and two very different HTML versions).