fvsch / kirby-twig

Twig templating support for Kirby CMS 2. For Kirby 3, use https://github.com/amteich/kirby-twig
MIT License
70 stars 8 forks source link

Added class check for Twig Library #5

Closed nunocodex closed 8 years ago

fvsch commented 8 years ago

Didn’t work for me (site/plugins/twig/vendor/autoload.php present, Twig_Environment not loaded before that).

Unless I’m mistaken: this will always throw if Twig was not loaded outside of the plugin (we would need to use and, not or in the condition). And if Twig was already loaded, it will reload it anyway, which is wasteful.

I did something a bit different but with the same intentions: https://github.com/fvsch/kirby-twig/commit/6c43d747b52d9c9bf0c3201f2926db2f4929d7d0#diff-93026c43a3912bff417fff6a5ec4767cL175

nunocodex commented 8 years ago

I writed fast and i lose this way, for me the best is this way: