Answer the question
In order to leave comments, you need to log in
Class 'Twig_Loader_Filesystem' not found in yii2?
Connected twig according to the manual
www.yiiframework.com/doc-2.0/guide-tutorial-templa...
Created the
views/layouts/main.twig template
and
views/articles/articles.twig
view
in config/web.php
'components' => [
// ...
'view' => [
'class' => 'yii\web\View',
'renderers' => [
'twig' => [
'class' => 'yii\twig\ViewRenderer',
'cachePath' => false, //'@runtime/Twig/cache',
// Array of twig options:
'options' => [
'auto_reload' => true,
],
'globals' => ['html' => '\yii\helpers\Html'],
'uses' => ['yii\bootstrap'],
],
],
],
],
return $this->render('articles.twig', compact('data'));
{
"require": {
"codeception/codeception": "*",
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "~2.0.0",
"yiisoft/yii2-twig": "~2.0.0"
},
"require-dev": {
"yiisoft/yii2-gii": "^2.0"
},
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question