CTPP
Encyclopedia
CTPP is a template engine
Template engine
A template engine is software that is designed to process web templates and content information to produce output web documents. It runs in the context of a template system.-Types:...

 completely written in C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

. It has bindings for Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...

, PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

 and Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

 languages.

CTPP Features

  • 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.

  • Flexible syntax of templates
If you are accustomed to the syntax of Smarty, HTML::Template or Text::Template, you can re-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.

  • Robustness
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.

  • Portability
CTPP library supports equally well Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

, FreeBSD
FreeBSD
FreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...

 and Solaris on i386, x86-64
X86-64
x86-64 is an extension of the x86 instruction set. It supports vastly larger virtual and physical address spaces than are possible on x86, thereby allowing programmers to conveniently work with much larger data sets. x86-64 also provides 64-bit general purpose registers and numerous other...

 and UltraSparc
UltraSPARC
The UltraSPARC is a microprocessor developed by Sun Microsystems who is now a part of Oracle Corporation and fabricated by Texas Instruments that implements the SPARC V9 instruction set architecture . It was introduced in mid-1995. It was the first microprocessor from Sun Microsystems to implement...

 platforms.

  • 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.

  • Unlimited levels of nested cycles and conditions

  • User functions
New functions can be added as needed in order to customize formatting data for the User interface
User interface
The user interface, in the industrial design field of human–machine interaction, is the space where interaction between humans and machines occurs. The goal of interaction between a human and a machine at the user interface is effective operation and control of the machine, and feedback from the...

.

  • Open-source software
CTPP is open-source software
Open-source software
Open-source software is computer software that is available in source code form: the source code and certain other rights normally reserved for copyright holders are provided under a software license that permits users to study, change, improve and at times also to distribute the software.Open...

 licensed under the BSD License.

Architecture of CTPP

The MVC
MVC
MVC may refer to:* Maha Vir Chakra, a military decoration in India* Marvel vs. Capcom, a video game series* Marvel vs. Capcom: Clash of Super Heroes* Monroe County Airport's IATA airport code...

paradigm divides an application into three basic entities: a set of Models, a Controller, and the View.

A classic implementation completely isolates these entities from each other. It is assumed that a View doesn’t process any data and only renders a corresponding object model according to the template, that a Controller is only used to determine the list of executed models, and that Models represent entirely abstract data sets and rules that govern the data.

This paradigm allows separating the functions of a web designer, a programmer and a manager. A lot of the code can be reused. In addition a project has a single entry point which facilitates its upgrading and development.

As represented in the diagram below the architecture of the template engine consists of 4 subsystems: a template compiler which converts the text of the page template into bytecode, a virtual machine which executes the bytecode, a caching system for templates, and a library of data processor functions.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK