OTPL
A simple template system, write once run everywhere with JavaScript (nodejs or in browser ), PHP ...
Your contributions are welcomed
Setup with npm
$ npm install otpl-js
Run Build
$ npm run build
Run Test
$ npm run test:run
Use case
Input: your template.otpl file content
<% $.label.text %> />
Usage: nodejs
var otpl = ;var data = 'label' : 'text' : 'Your password please :' 'input' : 'id' : 'pass_field' 'type' : 'password' 'name' : 'pass' ;//get otpl instancevar o = ;//parse your template o;//run your templated with your input data var output = o; console;
Usage: browser
var data = 'label' : 'text' : 'Your password please :' 'input' : 'id' : 'pass_field' 'type' : 'password' 'name' : 'pass' ; //get otpl instancevar o = ;//parse your template o;//run your templated with your input data var output = o; console;
Usage: php
$otpl = new \OTpl\OTpl(); $otpl->parse('template.otpl'); $data = array( 'label' => array( 'text' => 'Your password please :', ), 'input' => array( 'id' => 'pass_field', 'type' => 'password', 'name' => 'pass' ) ); $otpl->runWith($data);
Output
Your password please :