Twig- Include Template from other Directory
twig
Solution
No, it's not possible using `Twig_Loader_Filesystem`, because it explicitly rejects template names which have `..` inside. This can be verified into the definition of function `validateName($name)` inside file `Twig/lib/Twig/Loader/Filesystem.php`.
The only clean solution I can think of, if you need to access a template outside the path, is to create your own loader.
A workaround that does work, is defining a symbolic link inside the folder actually registered with `Twig_Loader_Filesystem`, pointing to the directory you want to access. Be careful with this method, point the link to a safe place.
Problem
Is it possible to include a template with `{% include %}` which is outside from the template path defined with: ``` $template = $twig->loadTemplate('example.tpl'); ``` I'm asking it because this line doesn't work: ``` {% include '.../example/navbar_left.tpl' %} ```