You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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!)
The text was updated successfully, but these errors were encountered:
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 insome_relative_folder
, but it only looks inroot_folder
and then errors saying it cannot findC.twig
.Should the documentation be updated to make that more clear? It defo tripped us up (we are not using aliases everywhere!)
The text was updated successfully, but these errors were encountered: