seblucas / dot-php
PHP rendering engine for doT.js (The fastest + concise javascript template engine for nodejs and browsers)
Installs: 6 398
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 4
Open Issues: 2
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2025-01-09 16:40:51 UTC
README
PHP rendering engine for doT.js (The fastest + concise javascript template engine for nodejs and browsers).
How to use it
// Load the library require_once('resources/doT-php/doT.php'); // Load the template $page = file_get_contents('templates/page.html'); // instanciate the object $template = new doT(); // Compile your templace in a PHP function ($dot) $dot = $template->template($page); // the data is simple PHP array $data = array('title' => 'My custom title'); // Write the HTML echo $dot($data);
Warning
It's far from complete. I needed it just to provide a server side rendering engine for another project (COPS).
So the code provided works perfectly for the templates of COPS and was never tested elsewhere, doT's unit test were also never tested.
That being said, You can fork, enhance it and send me some pull request, I'll happily merge them.