tigron / skeleton-template-twig
Skeleton的Twig模板
v2.0.16
2024-02-29 10:11 UTC
Requires
- michelf/php-markdown: ^1.8 || ^2.0
- twig/cache-extra: 3.*
- twig/extra-bundle: 3.*
- twig/markdown-extra: 3.*
- twig/string-extra: 3.*
- twig/twig: 3.*
This package is auto-updated.
Last update: 2024-08-29 11:20:30 UTC
README
描述
Skeleton的Twig模板。
安装
通过composer安装
composer require tigron/skeleton-template-twig
如何安装
加载库,指向你的模板目录,如果需要的话分配一个变量,然后开始使用!
<?php
$renderer = new \Skeleton\Template\Twig\Twig();
$renderer->add_template_path('/path/to/my/templates/');
$renderer->assign('my_variable', 'some value');
// Optional translation support (requires skeleton-i18n)
$renderer->set_translation($skeleton_i18n_translation_instance);
echo $renderer->render('template.twig');
额外配置
/**
* Enable debugging
*/
\Skelton\Template\Twig\Config::$debug = false;
/**
* Cache path
*
* This directory will be used to store the cached templates
*/
\Skelton\Template\Twig\Config::$cache_path = '/tmp';
/**
* Auto_escape
*
* Indicate if the resulting template should be auto-escaped
*/
\Skelton\Template\Twig\Config::$autoescape = true;