PHPackages                             phpffcms/ffcms-templex - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. phpffcms/ffcms-templex

ActiveLibrary[Templating &amp; Views](/categories/templating)

phpffcms/ffcms-templex
======================

Simple html template engine for ffcms on native php-html syntax

1.3.2(3y ago)02801MITPHPPHP ^8.1

Since Mar 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/phpffcms/ffcms-templex)[ Packagist](https://packagist.org/packages/phpffcms/ffcms-templex)[ Docs](http://pmcore.ru)[ RSS](/packages/phpffcms-ffcms-templex/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (1)Versions (18)Used By (1)

Templex
=======

[](#templex)

Templex - native php template system build on top of php plates framework: [thephpleague/plates](https://github.com/thephpleague/plates). Templex used in phpffcms as a basic template engine with pack of html helpers that makes posible fast build html-code output.

Installation
------------

[](#installation)

Using composer:

```
composer require phpffcms/ffcms-templex
```

Usage
-----

[](#usage)

To see complete examples please take a look on `/example` directory.

### Initialize

[](#initialize)

Here you can see a simple example of template system initialization:

```
$loader = require __DIR__ . '/vendor/autoload.php';

// initialize template engine
$tpl = new \Ffcms\Templex\Engine(__DIR__ . '/tpl');
// load default ffcms html helpers as extensions
$tpl->loadDefaultExtensions();

// render /tpl/block.body.php example
echo $tpl->render('block/body', ['test' => 'some value']);
```

### Use layouts

[](#use-layouts)

The major feature of any template system is a layouts. Plates provide a complete feature to use layouts in templating:

```
$this->layout('path/to/file', ['var' => 'value']);
```

### Sections extend

[](#sections-extend)

Section allow you to make dynamic templates with block override features. To understand how section extending works take a look at simple example:

`/tpl/block/body.php`

```
