Developer(s) | Invenzzia Group |
---|---|
Stable release | 2.0.6 / September 3, 2010 |
Preview release | 2.1-beta1 / September 3, 2010 |
Written in | PHP |
Type | Template Engine |
License | BSD-like |
Website | www.invenzzia.org |
Open Power Template is a web template engine written in PHP 5. A common strategy in designing web application is separation of the application logic (i.e. data processing) from the presentation (displaying the data). OPT is a tool for implementing such separation. The presentation layer is represented by templates, text files with HTML code and extra instructions controlling the data substitution.
OPT uses a dedicated XML template language for writing templates. It is not a general-purpose, but a domain-specific language. It was primarily designed to support and simplify template-specific problems with a set of declarative instructions. Instead of implementing the rendering algorithms and statements, like in imperative programming, the template designer specifies the expected result and features. This aims to ease the costs and efforts associated with the software development and further maintenance.
The library provides an object-oriented API based on the solutions from popular frameworks. As it is the first member of a bigger project, Open Power Libs, it is built upon a small OPL core library which provides the basic features.
The project started in November 2004, as a template engine for a discussion board project inspired by Smarty. While it later failed, the library became independent. In July 2006, the version 1.0.0 was released. It offered a template language with Smarty-like syntax and a small set of declarative instructions.
In January 2007, the developers release the version 1.1.0 which brings some notable improvements, such as pagination support and tree rendering.
In January 2008, the developers form an open-source programming team, Invenzzia to develop OPT and other PHP projects. At the same time, the development of Open Power Template 2.0 began.
The last version of the 1.1 branch was released in May 2008 and the group focused on the OPT 2.0 development. The new library went into the beta-stage in December and the first stable version was released in July 2009.
The OPT 2.0 template language is an XML application and allows to manipulate the XHTML document structure. The other features are:
The built-in XML parser can be reconfigured to parse certain HTML documents or plain text content.
Since the templates are separated from the application logic, you need at least two files. The first one contains the presentation code as an XML template:
<?xml version="1.0" ?><opt:rootescaping="yes"><opt:prologversion="1.0"/><opt:dtdtemplate="xhtml10transitional"/><html><head><title>{$pageTitle}</title><metahttp-equiv="content-type"content="text/html; charset=utf-8"/></head><body><p>{$introduction}</p><!-- display a list --><opt:showname="list"><ol><liopt:section="list">{$list.item}</li></ol></opt:show></body></html></opt:root>
The second one generates the data and configures the library:
require('./libs/Opl/Base.php');Opl_Loader::setDirectory('./libs/');Opl_Loader::register();$tpl=newOpt_Class;$tpl->sourceDir='./templates/';$tpl->compileDir='./templates_c/';$tpl->setup();$view=newOpt_View('template.tpl');// Assigning the script data to the template$view->pageTitle='Sample OPT page';$view->introduction='Sample text';$view->list=array(0=>array('item'=>'Item 1'),array('item'=>'Item 1'),array('item'=>'Item 1'));$view->setFormat('list','Array');$output=newOpt_Output_Http;$output->render($view);
A document type definition (DTD) is a set of markup declarations that define a document type for an SGML-family markup language.
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScript.
XSLT is a language for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF, PostScript and PNG. XSLT 1.0 is widely supported in modern web browsers.
Mathematical Markup Language (MathML) is a mathematical markup language, an application of XML for describing mathematical notations and capturing both its structure and content. It aims at integrating mathematical formulae into World Wide Web pages and other documents. It is part of HTML5 and an ISO standard ISO/IEC DIS 40314 since 2015.
Wireless Markup Language (WML), based on XML, is a now-obsolete markup language intended for devices that implement the Wireless Application Protocol (WAP) specification, such as mobile phones. It provides navigational support, data input, hyperlinks, text and image presentation, and forms, much like HTML. It preceded the use of other markup languages now used with WAP, such as HTML itself, and XHTML.
Quanta Plus, originally called Quanta, is a web Integrated development environment (IDE) for HTML, XHTML, CSS, XML, PHP and any other XML-based languages or scripting languages. Quanta was licensed under GPL before the release of version 2.0 final.
Smarty is a web template system written in PHP. Smarty is primarily promoted as a tool for separation of concerns. Smarty is intended to simplify compartmentalization, allowing the front-end of a web page to change separately from its back-end. Ideally, this lowers costs and minimizes the efforts associated with software maintenance.
A user interface markup language is a markup language that renders and describes graphical user interfaces and controls. Many of these markup languages are dialects of XML and are dependent upon a pre-existing scripting language engine, usually a JavaScript engine, for rendering of controls and extra scriptability.
The following tables compare general and technical information for a number of document-markup languages. Please see the individual markup languages' articles for further information.
Windows Presentation Foundation (WPF) is a free and open-source graphical subsystem originally developed by Microsoft for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initially released as part of .NET Framework 3.0 in 2006. WPF uses DirectX and attempts to provide a consistent programming model for building applications. It separates the user interface from business logic, and resembles similar XML-oriented object models, such as those implemented in XUL and SVG.
Apache Wicket, commonly referred to as Wicket, is a component-based web application framework for the Java programming language conceptually similar to JavaServer Faces and Tapestry. It was originally written by Jonathan Locke in April 2004. Version 1.0 was released in June 2005. It graduated into an Apache top-level project in June 2007.
A web template system in web publishing lets web designers and developers work with web templates to automatically generate custom web pages, such as the results from a search. This reuses static web page elements while defining dynamic elements based on web request parameters. Web templates support static content, providing basic structure and appearance. Developers can implement templates from content management systems, web application frameworks, and HTML editors.
Haml is a templating system that is designed to avoid writing inline code in a web document and make the HTML cleaner. Haml gives the flexibility to have some dynamic content in HTML. Similar to other web languages like PHP, ASP, JSP and template systems like eRuby, Haml also embeds some code that gets executed during runtime and generates HTML code in order to provide some dynamic content. In order to run Haml code, files need to have .haml extension. These files are similar to .erb or eRuby files which also help to embed Ruby code while developing a web application.
Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages. It mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated.
XPath is a query language for selecting nodes from an XML document. In addition, XPath may be used to compute values from the content of an XML document. XPath was defined by the World Wide Web Consortium (W3C).
EPUB is an e-book file format that uses the ".epub" file extension. The term is short for electronic publication and is sometimes styled ePub. EPUB is supported by many e-readers, and compatible software is available for most smartphones, tablets, and computers. EPUB is a technical standard published by the International Digital Publishing Forum (IDPF). It became an official standard of the IDPF in September 2007, superseding the older Open eBook standard.
XQuery is a query and functional programming language that queries and transforms collections of structured and unstructured data, usually in the form of XML, text and with vendor-specific extensions for other data formats. The language is developed by the XML Query working group of the W3C. The work is closely coordinated with the development of XSLT by the XSL Working Group; the two groups share responsibility for XPath, which is a subset of XQuery.
papaya CMS is an open-source content management system, free of charge and complying with open standards like XML as data format, XSLT as templating language, and PHP for programming.
Thymeleaf is a Java XML/XHTML/HTML5 template engine that can work both in web (servlet-based) and non-web environments. It is better suited for serving XHTML/HTML5 at the view layer of MVC-based web applications, but it can process any XML file even in offline environments. It provides full Spring Framework integration.