Bug #61006

Fluid partial is not rendered if folder with same name exists

Added by Hans Höchtl over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2014-08-16
Due date:
% Done:

0%

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

Description

If the following file structure is present:

Resources/Private/Partials/Foo.html
Resources/Private/Partials/Foo/Bar.html

The partial Foo can not be rendered, because the search order for the partial is:

$paths = array(
  'Resources/Private/Partials/@partial',
  'Resources/Private/Partials/@partial.html'
);

And the function file_exists checks if the partial exists and the folder is the first one checked and returns true, so Fluid generates an empty rendered partial.

In TYPO3 CMS fluid/Classes/View/TemplateView.php:473

This relates to #39868


Related issues

Related to TYPO3 Core - Bug #61007: Fluid partial is not rendered if folder with same name existsClosed2014-08-16

Actions
#1

Updated by Anja Leichsenring over 7 years ago

  • Project changed from 2559 to TYPO3 Core
  • Category deleted (Fluid)
  • TYPO3 Version set to 6.2
  • Is Regression set to No
#2

Updated by Markus Klein over 7 years ago

  • Target version changed from Fluid 6.2 to next-patchlevel

@Anja: Any reason you removed the regression flag?

#3

Updated by Claus Due over 6 years ago

  • Status changed from New to Closed

I'm closing this one but with a bit of back story and a workaround:

The reason that the lookup happens in the order it does, is that you are able to specify for example `<f:render partial="MyPartial.json" />` to overrule the otherwise automatically inserted format. Because of this, the first path we check must be the one that doesn't contain the format - e.g.:

1. Resources/Private/Partials/MyPartial.json (valid)
2. Resources/Private/Partials/MyPartial.json.html (not valid, not touched)

But because Fluid itself doesn't bother if a resolved file is a file or a folder, it returns TRUE in your case on the first path without the format because you've got the folder. So, to work around this, simply add the expected format in your `f:render` and you won't have any problems.

Finally, I'm closing this one because once standalone Fluid is merged, this becomes a non-issue. This Fluid version is already explicit about expecting a file when resolving template paths - https://github.com/TYPO3Fluid/Fluid/blob/master/src/View/TemplatePaths.php#L664.

Also available in: Atom PDF