Jump to content

Recommended Posts

OK, after several months of work I managed to release the first beta version of the new branch of my template engine. As you might expect, it would be nice to test it somehow, especially some new features and the interoperability with other libraries and PHP scripts.

 

What is it?

 

Open Power Template is a template engine that I've been developing for several years. I started writing it, because I was tired of writing templates in pure PHP, and I was disappointed with other template engines which only reinvented the wheel and provided a limited subset of PHP. OPT focuses on declarative programming and hiding as much template implementation details, as possible, without loosing the generality. I.e. instead of implementing a loop from scratch, we can just say that here we want to have a list of elements, and a single element should look like this. The compiler will do the rest and make it work. As a template language, it uses an XML application with an extra expression language based on PHP, but optimized for deploying within XML documents. It takes some time to get used to the project philosophy, but once we understand it, writing templates becomes much easier.

 

A small note about popularity: Open Power Template is very popular in my home country (Poland). In other countries, the situation is not so good, but it is also in use. Tutorials, manual etc. are available in English.

 

One more note: the library requires PHP 5.3.0 or newer.

 

What to test?

 

OK, but let's get back to the main issue. Open Power Template 2.1 brings lots of changes, improvements and new features. The source code is almost two times bigger, than in version 2.0 and many pieces of existing code have been rewritten from scratch. There are lots of changes in the internal template compiler structure, and I need to be pretty sure they do not break anything. The unit tests currently cover only a part of the library, because writing them also requires time, and the testing framework has been changed in the new branch.

 

If you are somehow a user of OPT 2.0, I would be grateful for testing the old templates in the new branch. I know many of them will not work, because of the changes in the template language, but I'm writing a special backward compatibility mode and a template converter, so I need information about all the places, where the compatibility is currently lost.

 

The rest is quite simple: whether the library does not crash somewhere, is the compiler memory usage relatively normal, whether the existing features work as they are supposed to.

 

It would be also nice to test the autoloader which is designed to handle any PHP library that follows PSR-0 class naming standard.

 

Unit testing

 

If you need to run unit tests, you must have PHPUnit 3.4. For testing the autoloader, you must also download vfsStream library mentioned in the PHPUnit user manual.

 

Running the tests:

 

phpunit --configuration config.xml AllTests
phpunit --configuration nocover.xml AllTests

 

The second configuration does not generate a code coverage report. Do not forget to create a paths.ini file with the paths to the libraries at the top of /tests directory:

 

Opl = "/path/to/Opl"
Opt = "/path/to/Opt"

 

Feature opinions

 

If you do not want to test the code, you can just take a look at feature list and the way they have been implemented. I would be especially grateful for real-life case studies of different templating problems and some analysis whether they could be easily implemented in OPT or not, and where the problem lies.

 

How to get

 

OK, it's time for some addresses. Firstly, the library itself:

 

http://www.invenzzia.org/en/download/open-power-template/2-1/2-1-beta1

 

The package contains two files with the descriptions of changes and new features. Unfortunately, the new documentation is being written now, so you must use the manual from 2.0 version and pay attention to the changes described in the archive:

 

http://static.invenzzia.org/docs/opt/2_0/book/en/

 

Some tutorials might be also useful to begin with:

 

http://www.invenzzia.org/en/resources/articles?tag=open-power-template

 

Source code for those ones who do not want to download anything:

 

http://github.com/OPL/Open-Power-Template

 

And at last, some stuff for mods: http://static.invenzzia.org/phpfreaks.txt

Link to comment
https://forums.phpfreaks.com/topic/212436-open-power-template-21-beta1/
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.