An open API service indexing awesome lists of open source software.

https://github.com/silassare/otpl-php

A simple & lightweight template system: write once compile everywhere with JavaScript, PHP ...
https://github.com/silassare/otpl-php

otpl php template template-engine

Last synced: about 2 months ago
JSON representation

A simple & lightweight template system: write once compile everywhere with JavaScript, PHP ...

Awesome Lists containing this project

README

        

# OTPL

A simple template system, write once run everywhere with JavaScript (nodejs or in browser ), PHP ...

## Your contributions are welcomed

- [JS Project](https://github.com/silassare/otpl-js/)
- [PHP Project](https://github.com/silassare/otpl-php/)

## Setup with composer

```sh
$ composer require silassare/otpl-php
```

## Use case

### Input: your template.otpl file content

```html
<% $.label.text %>
/>
```

### Usage: php

```php
parse('template.otpl');
$data = array(
'label' => array(
'text' => 'Your password please :',
),
'input' => array(
'id' => 'pass_field',
'type' => 'password',
'name' => 'pass'
)
);

$otpl->runWith($data);

```

### Output

```html
Your password please :

```