Bug #38369

Resource ViewHelpers should not fall back to request package

Added by Bastian Waidelich almost 10 years ago. Updated almost 10 years ago.

Must have
Target version:
Start date:
Due date:
% Done:


Estimated time:
Has patch:


Currently the f:uri.resource ViewHelper uses the package key of the current request to determine the absolute resource path, if no package is specified.

The resource interceptor that replaces links to assets by the resource viewhelper, so:

<link rel="stylesheet" href="../../../Public/Stylesheets/SomeFile.css" media="all" />

is (internally) converted into
<link rel="stylesheet" href="{f:uri.resource(resource: 'Stylesheets/SomeFile.css')}" media="all" />

So the resource ViewHelper uses the current package key to resolve the path to: Current/Package/Resources/Public/Stylesheets/SomeFile.css.
While this mostly works for FLOW3, in Phoenix the current package is usually TYPO3.TYPO3 and resources are located in some site package.

Therefore the TypoScript Fluid renderer sets the requests package key from the Fluid template path:

if (strpos($templatePath, 'resource://') === 0) {
    $tmp = substr($templatePath, 11);
    $tmp2 = explode('/', $tmp);


This has the side effect, that all links in the Fluid template now point to the site package instead of the FrontendNode controller of the TYPO3 package!

I didn't set the category to ViewHelpers because IMO this should be fixed in the view: We probably need something like resourcesPackage or similar that should be used by the resource ViewHelper instead of the requests package key.

Also available in: Atom PDF