Project

General

Profile

Actions

Bug #77235

closed

Collision of page template partials having the same name as fluid_styled_content partials

Added by Marco Kuprat almost 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2016-07-24
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

FLUIDTEMPLATE partials which have the same filename as partials in typo3/sysext/fluid_styled_content/Resources/Private/Partials/ won't get rendered. TYPO3 tries to render the partial from fluid_styled_content instead.

Example:
Part of my setup looks like this:

page.10 = FLUIDTEMPLATE
page.10.partialRootPaths.10 = fileadmin/templates/Partials

In the folder "Partials" I have a file "Footer.html", containing a section "footer".
In my fluid template I want to render section "footer" from this partial:

<f:render partial="Footer" section="footer" />

This leads to an exception in the frontend: "Section 'footer' does not exist".
The reason is that TYPO3 tries to render the partial "typo3/sysext/fluid_styled_content/Resources/Private/Partials/Footer.html" which doesn't have the required section.
Changing my partial to a filename that doesn't exist in the fsc folder solves the problem, but that could lead to problems if an update of fluid_styled_content brings new files.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #79760: FLUIDTEMPLATE not rendered when Layout name collides with Layout name of FSCClosed2017-02-11

Actions
Actions #1

Updated by Frans Saris almost 8 years ago

  • Status changed from New to Needs Feedback

You need to make sure your partial path has a higher priority then the root partial path.

Try

page.10.partialRootPaths.200 = fileadmin/templates/Partials
Actions #2

Updated by Frans Saris almost 8 years ago

Just checked https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/fluid_styled_content/Configuration/TypoScript/Static/Setup/lib.fluidContent.ts and partialRootPaths.10 should be ok. Can you check the typoscript object browser to see what paths are set.

Actions #3

Updated by Marco Kuprat almost 8 years ago

TSOB says:
page.10.partialRootPaths.10 = fileadmin/templates/Partials

Changing the priority of the partial to 200 doesn't solve the problem.

Actions #4

Updated by Marco Kuprat over 7 years ago

The cause of the problem lies in typo3_src-8.2.1/vendor/typo3fluid/fluid/src/View/AbstractTemplateView.php.

Method render():

$this->baseRenderingContext is not set. It should be set by the method "setRenderingContext()", which gets called from __construct().
However, the constructor does not get called. I tried putting a simple "die()" in the constructor, which had no effect.

Actions #5

Updated by Riccardo De Contardi over 7 years ago

still present on 8.3-dev (latest master)

Actions #6

Updated by Claus Due over 7 years ago

Regarding:

The cause of the problem lies in typo3_src-8.2.1/vendor/typo3fluid/fluid/src/View/AbstractTemplateView.php.

This is not correct. StandaloneView overwrites the constructor and supplies its own RenderingContext. The method is not expected to be called when rendering via StandaloneView. The baseRenderingContext is set by `setRenderingContext` which is called in StandaloneView::__construct. So, that part is completely in order and not the cause of this problem. Furthermore, if no rendering context was set, you would see fatal PHP errors (yes, it is a less than ideal approach to use a completely overwritten constructor, but there are reasons why this is done. The main hint is that the view is standalone).

Still working to find the cause and solve the problem.

Actions #7

Updated by Claus Due over 7 years ago

I've been trying for some hours now to reproduce this problem with no luck. Using a blank site with only fluid_styled_content TS loaded and the following custom setup:

page = PAGE
page.10 < styles.content.get

page.200 = FLUIDTEMPLATE
page.200.file = fileadmin/templates/Index.html
page.200.partialRootPaths {
    10 = fileadmin/templates/Partials/
}

page.300 = FLUIDTEMPLATE
page.300.file = fileadmin/templates/Other.html
page.300.partialRootPaths {
    10 = fileadmin/templates/OtherPartials/
}

With all paths containing exactly the Footer.html template.

I get the correct expected result when rendering any of those objects. In CMS the View instance creates a fresh rendering context on each FLUIDTEMPLATE object and the Fluid compiler generates three different compiled partial templates.

The one thing I was able to find were some redundant lines in the AbstractTemplateView class which caches partial identifiers in the View - which is not necessary (done at very next level inside TemplateParser anyway). This would break code where a custom View implements SingletonInterface (Views should never do this) or is treated as a singleton by code (e.g. stored in an internal cache and reused). I will prepare a fix for that but I can't see how it would affect this issue.

So please re-confirm that this is still an issue and if it is, include your entire TS object including the `.file`, `.templateName` or whatever you use. If it is no longer a problem please close the issue.

Actions #8

Updated by Marco Kuprat over 7 years ago

Claus, thank you for your investigation.
I could not reproduce the problem in an almost blank TYPO3 8.3.1 either. Maybe it was solved somewhere between 8.2.1 and 8.3.1.

Issue can be closed.

Actions #9

Updated by Björn Jacob over 7 years ago

  • Status changed from Needs Feedback to In Progress
  • Assignee set to Björn Jacob

Please, do not close this issue. I'm on it ;)

Actions #10

Updated by Daniel Goerz over 7 years ago

  • Category set to Fluid
  • Status changed from In Progress to New
  • Target version set to 8.6

Hi,
what is the status here? Björn, I doubt you are still on it after 3 months, right? ;)

I was able to reproduce this while trying to solve this SO issue: http://stackoverflow.com/questions/41418911/typo3-v8-5-with-fluidtemplate-and-fsc-partials-not-working
Reproduces it as desribed in the SO question.

Actions #11

Updated by Benni Mack about 7 years ago

  • Target version changed from 8.6 to 8 LTS
Actions #12

Updated by Benjamin Kott about 7 years ago

Hey, here is a sitepackage to reproduce the error.
https://github.com/benjaminkott/example_package

As soon as the variable with a fluid styled content applied, paths for the page will be overwritten then the ones from fsc are used.

Actions #13

Updated by Benni Mack almost 7 years ago

  • Target version changed from 8 LTS to next-patchlevel
Actions #14

Updated by Bernhard Berger almost 7 years ago

Daniel Goerz wrote:

Hi,
what is the status here? Björn, I doubt you are still on it after 3 months, right? ;)

I was able to reproduce this while trying to solve this SO issue: http://stackoverflow.com/questions/41418911/typo3-v8-5-with-fluidtemplate-and-fsc-partials-not-working
Reproduces it as desribed in the SO question.

The same bug occurs if 2 or more extensions use the same name for a layout. e.g. news uses the layout name "General". If you have an extension that uses the same name it will result in broken output.

How did 8.7 even get released with a MAJOR breaking bug like this? Basically renders 8.7 useless to anyone who needs to develop extensions or even install them..

Actions #15

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from New to Closed
  • Assignee deleted (Björn Jacob)
  • Target version deleted (next-patchlevel)

The patch from #79760 has been merged, so I close this one for now, as it should be solved. Please reopen if it occurs again (or ping me and I'll do that). Thank you!

Actions

Also available in: Atom PDF