|home | news | documentation | source | downloads | discussion | projects | license|
Comparison with PHP, ASP, JSP
Comparison with XML/XSLT
API ConceptsThe clearsilver API is separated into three componenents: HDF Objects, CS Objects, and the CGI Kit.
1. HDF ObjectsThe Hierarchial Data Format (HDF) is managed by HDF Objects. These objects provide an API to load, save, read, and change HDF datasets. Because of the direct naming scheme used in HDF, interacting with this dataset is generally much easier than with DOM datasets such as XML. For more information about HDF read the HDF Concepts. However, keep in mind that HDF datasets are always organized in insertion order.
The following simple Java example should give you an idea of how to create and access HDF datasets. See the language-specific documentation for more specific information.
2. CS ObjectsThe Clearsilver template rendering is managed by CS objects. These objects are handed an HDF dataset environment, and a set of clearsilver template fragments, either from strings or files. The objects parse the run the template fragments and ultimately produce a formatted output string.
The following simple Java example should give you an idea of how to render a template using HDF and CS objects together.
3. CGI KitThe CGI Kit is optional and handles form get or post query parsing, redirects, and other CGI functions. It is designed to fit well into an apache CGI or apache module environment. In addition to performing the functions you expect of other CGI handling systems, this kit also pre-populates information into the HDF dataset. For example, HTTP query variables are put in the dataset as Query.varname. This allows CS Templates to get access to query variables in a standard way without any additional code.
Some environments suppily their own CGI handling, such as