-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue with layouts renderer and sections => merge sections in one view #2491
Comments
@RedskyThirty Can you provide view files you're using? Views are rendered using the sharedRenderer service. I'm noticing some issues with properties $sections and $layout not being reset after outputting the view. I'm mostly interested which name you're using for section. |
@najdanovicivan I'm sorry, I cannot share my real files but here is what they look like: Layout 01
View 01
Layout 02
View 02
|
FYI, I renamed "body" by something like "l1_body" and "l2_body" to prevent the issue. |
Yes. Exactly what I'was taking about. As sections are not being reset on the end of rendering having sections with the same name in multiple layouts can cause issues. |
Yes, but am I wrong if I say that for the moment the framework has no method to finalize a "renderSection()"? |
I've submitted PR for this one. I've only added one line in the code. Can you manually paste
After line 249 in system/View/View.php to see if it fixes the issue for you ? |
We’ll have to wait on the test outcome but this looks like a good and isolated change so I’m glad to merge shortly. |
Oops, GitHub auto-closed. @RedskyThirty can you confirm if this is resolved? |
I don't have time to test now but I suppose it's ok ;-) |
@MGatner auto close happens because I put Fixes prefix in PR message
So once PR is merged the Issue gets closed automatically. I'm gonna send future PRs with Reference only |
This was causing other issues that we don't have tests in place for; I had to revert the change for now until we can look into it. |
@MGatner can you provide me a sample where the issue happens so that I can create test and then check the issue in more detail? |
Sure. It happened on this project: https://github.com/MGatner/nexus Notice that the layout has its own sub-calls to views, which I think is where the issue is. When the parser clears the sections those nested calls don’t resolve. |
Here you can find a simple demo of the issue ;-) |
@MGatner and @RedskyThirty I've submitted new PR which takes a different approach on this one. Additionally I've included the unit test for the mentioned issue. it will be great if you can do some testing on your end. |
Hello,
It seems that there is a problem with the layouts and I think that this is due to "ob_start / ob_flush / ..." in the renderer.
It will be easier to explain my problem with an example...
View "email" extends a layout "x" with a section called "body".
View "confirmation" extends another layout "y" with a section called "body".
Sometimes (but not always), "view('confirmation')" displays the "body" section of "email" and "confirmation". The renderer merges both sections even if the layout is not the same.
This is really annoying. For the moment, I try to prefix all my sections in each layouts but it would be better if I didn't have to do this kind of things.
The text was updated successfully, but these errors were encountered: