v0lkan/o2.js — Issue #50: implement a PHP counterpart for the template engine.
Author: v0lkan
Created: 2011-12-14 06:39:01+00:00
State: open

The o2.Template class uses JavaScript array as a basis for templating.
And this enables extremely fast and efficient template rendering when compared to alternatives (such as mustache)

[
"

",
[
"each users",
[
"
{name}
"
]
],
"

"
]

Yeah I know, the o2.Template is incomplete and its rule engine is rather primitive. But that's not the point.
The point is; it's darn fast!

The good part is that the above template expression is also a valid JSON. -- which means that it can be easily converted to a PHP nested array. This will enable us implement the same templating logic in the PHP side as well.

Therefore we can have identical server-side and client-side rendering of the templates.