Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I want to use my layouts in a different folder that calls base or main layout in project and use them every twig files that can be extended.
views
| site
|index.htm
| layouts
|main.htm
Now If I call render like this from Sitecontroller I can not extend main.htm, because it is not in site view folder, it is in the layouts folder.
So from index.htm (inside site folder) want to extend main.htm (inside layouts folder) gives error. Can not find main.htm, because twig only look in to site folder....
{% extends "main.htm" %}
http://stackoverflow.com/questions/24247569/twig-template-layout-yii2-framework
So I change the file and now I can define layouts folder with Twig_Loader_Filesystem and after that in function render, I can addPath my file folder path site/index.htm .. so twig search the files in two folders - layouts and site folders. If you want we can change the $define_layout as an array and from config file we can send more than one folders that can twig search for. If there is another simple way to do this I would be very happy to learn how can I do this ..
Now I only use it like one variable.
Config :
'define_layout' => '/views/layouts',
Regards,