Plates is a native PHP template system that is very easy to use and extend, inspired by the Twig template engine, including modern template language features. Plates is primarily provided for developers who choose to use native PHP templates in the compilation template language.
Here are a simple example of what to use Plates. We'll assume the following directory stucture:
'--Path '--to '--templates |--template.php |--profile.php
Within your controller
Create new Plates instance$templates = new League\plates\engine ('/path/to/templates ');//Render a Templateecho $templa Tes->render (' profile ', [' name ' = ' Jonathan ']);
The page template
profile.php
Layout (' template ', [' title ' = ' User profile '])?>User profile
Hello,
E ($name)?>
The layout template
template.php
<?= $this->e ($title)?>
Section (' content ')?>
Notable features
Native PHP templates, no need to learn new syntax
Plates is a template system, not a template language
Plates encourages the use of existing PHP functions
Promoting code reusability with template layout and inheritance
Cross-template data sharing
Built-in Escape helper function
No fixed frame, can be used in any project
Decoupled design for easy testing
Support Composer, compatible with PSR-2
Project home:http://www.open-open.com/lib/view/home/1431008255398