Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ViewRenderer.php #3907

Closed
wants to merge 1 commit into from
Closed

Update ViewRenderer.php #3907

wants to merge 1 commit into from

Conversation

cansozeri
Copy link

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.

public function actionIndex()
{

    return $this->render('index.htm');
}

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,

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 I can not extend main.htm, because it is not in site view folder, it is in the layouts folder. 

 public function actionIndex()
    {
		
        return $this->render('index.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 .. 

Regards,
@samdark samdark self-assigned this Jun 16, 2014
@samdark samdark modified the milestones: 2.0 GA, 2.0 RC Jun 16, 2014
@samdark
Copy link
Member

samdark commented Jul 19, 2014

Won't be merged as is. Probably will be solved as suggested in #3674 comments.

@samdark samdark closed this Jul 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants