This extension provides a ViewRender
that would allow you to use Smarty view template engine
with Yii framework 2.0.
For license information check the LICENSE-file.
Documentation is at https://github.com/yiisoft/yii2-smarty/blob/master/docs/guide/README.md.
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yiisoft/yii2-smarty
or add
"yiisoft/yii2-smarty": "~2.0.0"
to the require section of your composer.json.
Note that the smarty composer package is distributed using subversion so you may need to install subversion.
To use this extension, simply add the following code in your application configuration:
return [
//....
'components' => [
'view' => [
'renderers' => [
'tpl' => [
'class' => 'yii\smarty\ViewRenderer',
//'cachePath' => '@runtime/Smarty/cache',
],
],
],
],
];
setTemplateDir()
to addTemplateDir()
(alex-net)registerJs
and registerCss
blocks in PHP 8 (simialbi){js}
function allowing instantiate yii\web\JsExpression
(leandrogehlen){use}
for functions and blocks in inherited templates (freezy-sk)functionRegisterJsFile
position parameter (TomassunGitHub, samdark){registerCssFile
and {registerJsFile
(TomassunGitHub, samdark){use class='yii\bootstrap\Nav' type='function'}
(ivanlemeshev){path
was generating absolute URLs instead of relative ones (samdark, motzel)url
generates absolute URL.set
allows setting commonly used view parameters: title
, theme
and layout
.meta
registers meta tag.registerJsFile
registers JavaScript file.registerCssFile
registers CSS file.use
allows importing classes to the template and optionally provides these as functions and blocks.title
.description
.registerJs
.registerCss
.void
that allows calling functions and ignoring result.\yii\smarty\Extension
class that could be extended via extensionClass
property.options
.imports
property that accepts an array of classes imported into template namespace.widgets
property that can be used to import widgets as Smarty tags.Yii::$app->params['paramKey']
values are now accessible as Smarty config variables {#paramKey#}
.extends
and require
.
Comments