vendredi 30 octobre 2015

Cannot get the twig bridge working in laravel

So, i am giving laravel a try however i want to use twig instead of blade.

http://ift.tt/1ExNwnB

This guy wrote a "bridge" for it but i cannot get it to work.

I have added to the provider array in /config/app.php:

   ...
  'TwigBridge\ServiceProvider'
]

I've added to the aliases array in /config/app.php:

    'Twig' => 'TwigBridge\Facade\Twig',
],

But then in the readme it just shows these lines but doesn't really say where to put them:

Twig::addExtension('TwigBridge\Extension\Loader\Functions');
Twig::render('mytemplate', $data);

Without them in my routes.php file I have:

Route::get('/', function () {
    return view('hello.html.twig');
});

But all i get when i access said route is a twig error page saying

1 - in FileViewFinder.php line 137
2 - at FileViewFinder->findInPaths('hello.html.twig', array('/var/vhost/project101/resources/views')) in FileViewFinder.php line 79
3 - at FileViewFinder->find('hello.html.twig') in Factory.php line 151

So I can only assume I have missed something, but really don't know what.

Any laravel fans out there who managed to get twig working?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/20gaBpz
via IFTTT

Aucun commentaire:

Enregistrer un commentaire