flatphp / lightemp
light template engine
v1.2.0
2022-03-07 16:42 UTC
Requires
- php: >=5.5
This package is auto-updated.
Last update: 2024-12-07 22:19:27 UTC
README
Lightemp is a light template engine.
Usage
$view = new \Lightemp\View('/project/view', array( 'cache' => true, 'vars' => array( 'static' => 'http://static.some.com', ), )); $name = 'Benjemin'; include $view->template('index.php', ['title' => 'Title of the document']);
Sample Template
head.php
<head> <meta charset="UTF-8"> <title>{$title}</title> <link href="{$static}/css/common.css" rel="stylesheet"> </head>
index.php
<!DOCTYPE html> <html> {include test/head.php} <body> hello <?=$name?> </body> </html>
Cache
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Title of the document</title> <link href="http://static.some.com/css/common.css" rel="stylesheet"> </head> <body> hello <?=$name?> </body> </html>
Labels
- {$var}
- {include template}
- {content template}