yiisoft/yii2-twig

Update documentation to remove reference to relative twig paths

developedsoftware opened this issue · 1 comments

As mentioned here twigphp/Twig#3730 (comment)

And also referencing issue #137

We have been trying to use relative paths in twig files as per the documentation below. Only to find out that twig does not actually support relative paths in twig files.

https://www.yiiframework.com/extension/yiisoft/yii2-twig/doc/guide/2.3/en/template-syntax#referencing-other-templates

In the first case the view will be searched relatively to the current template path. For comment.twig and post.twig that means these will be searched in the same directory as the currently rendered template.

Whilst I assume the above means, in the same path of the "first" rendered template (because that actually works). If you in root_folder/A.twig include a twig file (some_relative_folder/B.twig), and inside that twig file include another twig file (C.twig) you would expect it to look in some_relative_folder, but it only looks in root_folder and then errors saying it cannot find C.twig.

Should the documentation be updated to make that more clear? It defo tripped us up (we are not using aliases everywhere!)

Yes, needs to be updated. Would appreciate a pull request.