File: README.md

Recommend this page to a friend!
  Classes of Alexey Dodonov  >  Mezon PHP HTML Template Engine  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Mezon PHP HTML Template Engine
Process HTML templates replacing variables
Author: By
Last change:
Date: 1 year ago
Size: 1,652 bytes
 

Contents

Class file image Download

HTMP template class

Build Status codecov Scrutinizer Code Quality

Installation

Just type

composer require mezon/html-template

Usage

First of all you need to create object

$template = new \Mezon\HtmlTemplate\HtmlTemplate('./main-template/');

This code assumes that you have all template resources in the directory './main-template/'

But you can also specify a list of paths, and while template compilation they all will be scanned for static files.

$template = new \Mezon\HtmlTemplate\HtmlTemplate(['./main-template/', './extra-files/res/']);

No need to specify all paths in the constructor. You can do it later with methods:

$template = new \Mezon\HtmlTemplate\HtmlTemplate('./main-template/');
$template->addPaths(['./path1', './path2']);

But be carefull if you have static files with the same names on different paths. While compilation the file on the latest added path will be used. It was done so to create a sort of overriding mechanism for template resources.

Or you can completely reset all paths:

$template->setPaths(['./path1', './path2']);

And view a list of paths:

var_dump($template->getPaths());
For more information send a message to info at phpclasses dot org.