Conditional HTML

Conditional HTML (chtml), which was developed solely for use on the cluster, allows you to have elements in your HTML documents changed as they're being retrieved. In order to start using chtml, you'll need to make sure that either your web directory or one above it has a .htaccess file with the line:

chtmlUse on

Conditional HTML has many of the same features as Server-side Includes, but they are processed differently. Server-side Includes will process the file every time it is retrieved, but chtml will only process the file if it or any included files have changed.

Both static HTML files and PHP scripts are processed with chtml.

Another feature of chtml is that developers of CGI scripts have access to it, with the filter and postprocessing scripts. The filter mechanism is much more efficient, since it's possible for the processed template to be saved into the chtml cache. With postprocessing, that is not possible, since it's not possible to know exactly what will be given to the postprocessor.

The feature set of chtml is much like that of Server-Side Includes or PHP, but what makes chtml unique is that it does not process pages on every access, but only when any of the source files have been modified. This is especially an advantage when a file is accessed many more times than it changes. In addition to reducing the load on the server (thus improving performance), persistent connections are preserved when using chtml, since it will tell the web server to return a file, rather than generating content dynamically.

It is this file preprocessing ability which makes using filter templates much more efficient than using chtml as a CGI postprocessor; templates are static files, and chtml is able to only process those files when neccessary, but when used as a postprocessor, chtml must be invoked for every request.