PHP code example of vovan-ve / html-template

1. Go to this page and download the library: Download vovan-ve/html-template library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vovan-ve / html-template example snippets


use VovanVE\HtmlTemplate\runtime\RuntimeHelper;

$runtime = new RuntimeHelper([
    'link' => 'http://example.com?foo=bar&lorem=ipsum#hash',
    'title' => 'Lorem <ipsum> "dolor" sit amet',
    'description' => function () {
        return 'Some <text/plain> content';
    },
]);

echo $engine->runTemplate('foobar', $runtime);

($runtime::createElement('a', [
    'href'  => ($runtime->param('link')),
    'title' => (!($_ta=($runtime->param('title')))
        ? $_ta
        :(('Foo bar: '.($runtime->param('title'))))
    )
], [
    ($runtime::createElement('span', [
        'id'    => 'foobar',
        'class' => 'it parses html'
    ], [
        ($runtime::htmlEncode(($runtime->param('description'))))
    ])),
    '<span></span>'
]))

'<div>Lorem &lt; ipsum dolor</div>'