The "Pure Fluid" solution from the documentation throws an error

Issue #23 resolved
Robert Wildling created an issue

When implementing the “Pure fluid” solution, an error is thrown.

Fluid parse error in template partial_Footer/Footer_b59c21c8a51964a98cb785f2ffce73792c50c175, line 97 at character 4. Error: Unknown Namespace: rx (error code 0). Template source chunk: <rx:shariff services="facebook,twitter" />

Also, shouldn’t this one have a different identifier (“js” instead of “css”)? (Or what exactly does the identifier do?)

<f:asset.script identifier="shariff-css" src="EXT:rx_shariff/Resources/Public/JavaScript/shariff.min.js" />

Comments (6)

  1. Markus Klein

    hi.

    Yes, copying the pure snippet throws an error, because it should be used inside some other template.
    We assumed common integrator knowledge here, obviously, and didn’t mention the necessary namespace inclusion xmlns:rx="http://typo3.org/ns/Reelworx/RxShariff/ViewHelper. (Which is mentioned in the docs above)

    Regarding the identifier this should indeed be js to be more consistent. As far as I know the identifier is only used in the internals of the Core to register the file to load. The duplicate name shouldn’t cause an issue in this case, because it affects different asset types.

    As you didn’t push a PR for this yet, I take the freedom to fix the docs straight away.

  2. Robert Wildling reporter

    I guess I expected this to be an inline example… sorry, my fault! (However: How about providing an inline example for the docu just for the sake of completeness?)

  3. Robert Wildling reporter

    Not sure what you mean… you added the namespace tags, which I like - thanks! And you’ve fixed the identifier for js. Thanks!

    In case you ask back because of my inline comment, I would say that adding what you do in the template, would add to the quality of the docu:

    {namespace rx=Reelworx\RxShariff\ViewHelper}
    <rx:shariff data="{data}" services="{services}" enableBackend="{enableBackend}"/> 
    

    Because that way this plugin can be implemented in an existing template where there is already other stuff going on, right? LIke this:

    <div class="content-wrapper">
     <div class="footer-2">
       <div class="share-icons">
       {namespace rx=Reelworx\RxShariff\ViewHelper}
       <rx:shariff data="{data}" services="{services}" enableBackend="{enableBackend}" />
       </div>
       <div class="sponsors">
        <f:cObject typoscriptObjectPath="lib.dynamicContent" data="{ pageUid: '26', colPos: '21', slide: '0', wrap: '|', elementWrap: '|' }" />
       </div>
     </div>
    </div>
    

    (That, BTW, solve the problem from my other issue, where I report a problem with the layout!)

    However, that’s peanuts… (but there is a documentation competition going on, as far as I know… 😉 )

  4. Markus Klein

    Ah you mean the inline notation of the namespace inclusion.

    I am actually very surprised this works, because to my knowledge namespace imports are only supported at the very start of a Fluid file. That’s the reason we did not put this into the docs, because mostly you will add the viewhelper somewhere in between.

    To my eye, it actually reads a bit strange to have a namespace import somewhere in the middle of a Fluid code. Maybe that’s even pure coincidence that this works. I don’t know.

  5. Log in to comment