W
W
webmister2016-09-25 21:41:46
Yii
webmister, 2016-09-25 21:41:46

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'],
                        ],
                    ],
                ],
    ],

In the controller I call
return $this->render('articles.twig', compact('data'));

As a result, the composer.json
155de3a9a7a14d00b2d3d94f0e1ab737.PNG
file will be displayed
{
    "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

1 answer(s)
D
Dmitry, 2016-09-26
@slo_nik

Good morning.
In composer.json, in the "require" section, add "bower-asset/twig.js" : "[email protected]", then composer update

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question