NitroScript: A PHP Template Engine for Customizing of E-Commerce Applications

INTRODUCTION The model-view-controller architecture is often implemented in Web applications through the use of HTML templates. The ultimate goal of these templates is to dissociate the presentation of the Web page from its business logic. The increasing popularity of this paradigm has supported the case for the model-view-controller architecture to become the de facto standard programming model for Web application development [1]. There is a plethora of template engines available to Web programmers such as Smarty for PHP developers and Django for Python. Despite their popularity, these templates have several drawbacks between them. For instance, in the case of Smarty, the resulting code is interpreted as a native PHP code and thereby commanding a performance overhead. Another problem with these template engines is their potential security vulnerabilities. This paper presents our bespoke template engine called NitroScript. The next section will provide its motivation.

A. Motivating Example NitroSell is a company that provides integrated Ecommerce solutions to independent retailers. Its mission statement is to make it easy for retailers to increase profits by serving new and existing customers online. In order to do so, NitroSell offers a Software as a Service (SaaS) application that hides complexity, minimizes costs, and provides a highly productive and efficient operating environment. In 2011, NitroSell registered over 700 Web stores with each having about 40 templates. Still in the same year, 700 million page views were recorded [2]. The SaaS application makes use of a multi-tenant database in order to leverage the economy of scale. This means that all the Web stores are consolidated onto the same database. Retailers are constantly facing the conundrum of customizing their product pages as well as any other information in order to make it easy for their customers to navigate through their Web stores and locate the products they are looking for. Furthermore, the provider of the SaaS application (NitroSell) ought to provide to their customers (retailers) an interface, simple and easy to learn, to their customers. This highlights the complexity of dealing with the customization of each Web store. Furthermore, another consideration is that due to the fact that all customers shared the same instance of the database, care should be taken to ensure that customers’ data is stored securely. Indeed, the key question being raised here is related to the way a Web store can be customized without compromising another Web store’s private data in a multi-tenant system. As defined in [3], a multi-tenant Web application is an application that enables different customer organizations (also known as tenants) to use the same instantiation of a system, without necessarily sharing data or functionality with other tenants. The central research question being investigated in this paper can be formulated as follows: How can customization and configurability be realized in Multitenant web applications? This paper answers that question by presenting a PHP template engine that allows retailers to easily customize their Web stores.

B. Paper Contribution This paper presents NitroScript: a novel template engine written in PHP entirely dedicated to e-commerce. To best of the authors’ knowledge, NitroScript is the first template engine written in PHP for the sole use of e-commerce applications. By focusing solely on e-commerce, NitroScript addresses the challenges faced by e-commerce applications much better than any general purpose temple engine would have done. The main goal of NitroScript is to seamlessly facilitate the customization of the Web store by retailers.

C. Paper Structure The rest of the paper is structured as follows: Section II provides the background related to template-based programming as well as the definition of the concept of template. Section III covers the NitroScript template engine and its main building blocks. Section IV presents the related work to NitroScript, this includes the most relevant PHP template engines identified by the literature review. The paper is concluded in Section V where directions for further work are given.

ON TEMPLATE-BASED PROGRAMMING The rationale of template engines is to separate the application logic and data computations from the display of such data in both thought and mechanism [4]. This can be seen as an application of the model-view-controller paradigm first described in [5] as a pattern which aims at isolating ”domain logic” (the application logic for the user) from the user interface (input and presentation), thereby facilitating independent development, testing and maintenance of each (separation of concerns). The motivation behind the template engine was raised by the following key reasons [4]: Encapsulation; Clarity; Division of workload; Component reuse; Single-point-of-change; Maintenance; Interchangeable views; and Security.