What is the CTPP library?
How it works?
o In action
o In deveopment
What is CTPP?
Shortly, CTPP or CT Plus Plus is a tool separating data processing (business logic) from data presentation. CTPP is a suitable choice for projects where a programmer and an HTML designer are different people.
For example, you intend to create a regular HTML page, a printable version of this page and to export the data as RSS. Clearly, in most cases the same algorithm creates these pages; they only differ in the layout. Another situation may require customizing the design of the pages to the status of the user or the site needs to be redesigned while the engine stays the same..
Or “Why do we need CTPP if we have XXXX (insert your favorite tool)”?
It’s true that at this point there are many templatizers: PHP Smarty, Perl HTML::Template, Text::Template, Xalan, libxslt. They all have their upsides and downsides. At the end it’s you who will decide which tool best serves your needs.
The goal of CTPP development was to achieve maximum performance with minimal basic functionality that is easily expandable. In other words, any conceivable capabilities can be added by writing users functions.
o Very high performance
The CTPP library is very fast since it’s written entirely in C++. Unlike templatizers written in interpreted languages, like PERL or PHP, CTPP doesn’t spend time on interpreting the original code or on loading the execution environment.
At the same time, CTPP library is faster than the well-known projects like Xalan-C or libxslt because it doesn’t carry additional often superfluous functionality that costs in performance.
o Flexible syntax of templates
If you are accustomed to the syntax of Smarty, HTML::Template or Text::Template, you can configure CTPP to “understand” your old templates. Certainly there will be little adjustments, but typically there will be no problems converting to the new engine.
Since the areas of control of the programmer and the HTML designer are completely isolated there is no risk of breaking the logic by a wrong layout. Regardless of the HTML design the project will function exactly as developed by the programmer according to the functional specifications.
CTPP library supports equally well Linux, FreeBSD and Solaris.
o Support for implementations in the language of your choice
CTPP has C, C++, Perl5, PHP4, and PHP5 interfaces. It means that you can attach this library to any project written in popular programming languages.
o Unlimited levels of nested cycles and conditions
o User functions
New functions can be added as needed in order to customize formatting data for the UI.
o Output data filters
The template engine allows modifying the output data; for example, to add data compression with gzip or to add support for PHP-like session mechanism
o Various template sources
Templates can be read from disk, from shared memory or from any other data source.
The ability to write the code once and for all regardless of the page layouts proposed by the designer and irrespective of the project schedule. The same code can be reused in multiple projects.
Simplicity of building sites out of ready templates. No special knowledge of complex technologies like XSLT is required.
For Project manager:
Low cost and high speed of development, quality, robustness, and portability.
The division of labor between specialists expedites the development: the programmer doesn’t wait for the designer and vice versa. Moreover, as the repository of functions gets developed, programmer’s task practically shifts to packaging the right modules together.