Download the PHP package mezon/template-engine without Composer
On this page you can find all versions of the php package mezon/template-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mezon/template-engine
More information about mezon/template-engine
Files in mezon/template-engine
Package template-engine
Short Description Small template engine for your projects
License MIT
Homepage https://github.com/alexdodonov/mezon-template-engine
Informations about the package template-engine
Template engine
Intro
Template engine provides template compilation routine with variables, loops and other programming abstractions.
Loading resources
Mezon has a simple storage wich stores CSS and JS files. When page is rendered, template engine accessing it and fetching files to put in the 'head' tag of the rendered page.
Storage is globally accessed. So any componen can add it's own resources to the page.
It can be done in this way:
Resource storage is quite intilligent so you can't add many files with the same paths.
But this way of additing resources is quite low level and it may be inconvinient for large number of resource files. So we have created assets. The documentation about it can be read here
Page compilation
TemplateEngine class provides content compilation routine. This function is called TemplateEngine::print_record( $String , $Data ) wich replaces all variables {variable-name} with values from $Data.
Template variables
You can use template variables bounded by '{' and '}' symbols.
For example:
Extended page compilation
You may also use loopes in your templates.
For example:
And the output will be: