Fluid icon indicating copy to clipboard operation
Fluid copied to clipboard

Namespace declaration in output

Open potofcoffee opened this issue 8 years ago • 3 comments

I'm using the following template:

{namespace fx=Peregrinus\Flockr\Core\ViewHelpers}
<f:for each="{css}" as="file"><link rel="stylesheet" type="text/css" href="{f:if(condition: '{file.external}', else: '{baseUrl}')}{file.href}{f:if(condition: '{file.external}', else: '?{fx:format.date(format: \'U\')}')}"/>
</f:for>

The namespace for my ViewHelper is resolved correctly, but the following line appears in the output:

{namespace fx=Peregrinus\Flockr\Core\ViewHelpers}

Shouldn't this be suppressed?

potofcoffee avatar Dec 29 '16 19:12 potofcoffee

The syntax looks correct and should work. Is it possible you use a custom RenderingContext which prevents this line from executing, causing it to not return the namespace detection processor?

https://github.com/TYPO3/Fluid/blob/master/src/Core/Rendering/RenderingContext.php#L131

NamelessCoder avatar Dec 30 '16 10:12 NamelessCoder

No, this is just basic standalone Fluid. Also, the namespace IS being detected, just the declaration is passed through to the output.

Here's everything view-related that's happening in my controller: https://gist.github.com/potofcoffee/1992b31e67a96bd1122f1022c22590b4

potofcoffee avatar Dec 30 '16 10:12 potofcoffee

Thanks for the example! I checked the template processor and it does indeed not replace the detected namespace with an empty string (which it should do). This one will need a bugfix.

To avoid it you can use $view->getRenderingContext()->getViewHelperResolver()->addNamespace($alias, $namespace); which should be easy enough since you already use a controller with access to the view :)

NamelessCoder avatar Dec 30 '16 11:12 NamelessCoder

Hey. This has been fixed with various refactorings of involed classes meanwhile, has it?

lolli42 avatar May 04 '23 16:05 lolli42

Hey. I'm going to close here for now: I guess this has been fixed meanwhile. If this is still a problem, we may be better off with a fresh issue and would fix it quickly, but I hope this does not happen, even without looking up too many all details and doing an hour of code archaeology. I fear not too much will happen with this issue anymore, it's 7 years old by now, so I close hoping it's fixed.

lolli42 avatar May 10 '23 22:05 lolli42