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

[2.1 RC1] When using multiple directories in setViewsDir, views with same name are rendered for each dir #11633

Closed
maurits150 opened this issue Apr 6, 2016 · 3 comments
Assignees
Labels
bug A bug report status: medium Medium

Comments

@maurits150
Copy link

It seems that when using multiple view directories ($view->setViewsDir(['dir1', 'dir2']), and a view with same name exists in both directories, both files get rendered.

I'm not sure if this is intended behavior, but it seem unintuitive to me in the case of a hierarchical view system where only the first found view should be rendered.

Solution seems to be to change the following line to the Zephir equivalent of "break 2;" instead of just a plain break.

https://github.com/phalcon/cphalcon/blob/2.1.x/phalcon/mvc/view.zep#L714

This makes that not just the engines loop is terminated, but the view directories loop also.

@maurits150 maurits150 changed the title When using multiple directories in setViewsDir, views with same name are rendered multiple times. When using multiple directories in setViewsDir, views with same name are rendered for each dir Apr 6, 2016
@maurits150 maurits150 changed the title When using multiple directories in setViewsDir, views with same name are rendered for each dir [2.1 RC1] When using multiple directories in setViewsDir, views with same name are rendered for each dir Apr 20, 2016
@dschissler

This comment was marked as abuse.

@Jurigag
Copy link
Contributor

Jurigag commented Jun 23, 2017

Didn't even knew that you can set array there actually, never used it like this, not sure, it might be a bug. If this change which OP proposed will fix it then great.

@dschissler

This comment was marked as abuse.

@sergeyklay sergeyklay self-assigned this Jun 26, 2017
@stale stale bot added the stale Stale issue - automatically closed label Apr 16, 2018
@phalcon phalcon deleted a comment from stale bot Nov 11, 2019
@niden niden added 4.0 and removed stale Stale issue - automatically closed labels Nov 11, 2019
@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

5 participants