"Closing tag matches nothing" with TYPO3 Fluid inline syntax in HTML

Hi PhpStorm community!

As many TYPO3 developers use PhpStorm I finally took the time to evaluate it - and I really like it. But I have huge problems using TYPO3 Fluid inline syntax (see TYPO3 Forge and TYPO3 Flow Documentation) in HTML files. In bigger Fluid template files sometimes code folding leads to a state where most of the code can't be expanded because PhpStorm does not recognize tags with Fluid inline syntax (curly braces). Hava a look at this minimal example:

<div xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">

  <f:if condition="">

    <div{f:someting()}>

      <!-- something more -->

    </div>

  </f:if>

</div>

Fluid template files and partials are saved with .html file extensions and thus PhpStorm treats them as HTML.

If I collpase line 2 (<f:if...>) the code is folded as expected. But if I try to unfold it again, the code is even more collapsed to:

<div xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"...>

  </f:if>

</div>

The only way to unfold it again is either "unfold all" or unfold the root element and change the first </div> tag.

Bootstrap heavily uses custom html attributes. Using them in combination with fluid leads to my problem. Example: The data-ride="carousel" attribute is used to mark a Bootstrap Carousel as animating starting at page load. In Fluid I'd use something like...

<div id="foo"{f:if(condition:'{foo}', then:' data-ride="carousel"')}>

  <!-- more carousel code -->

</div>

...to optionally add this attibute. Without fluid shorthand syntax it would be...

<f:if condition="{foo}">

  <f:then>

    <div id="foo" data-ride="carousel">

  </f:then>

  <f:else>

    <div id="foo">

  </f:else>

</f:if>

  <!-- more carousel code -->

</div>

Using shorthand syntax I got the "Closing tag matches nothing" error and collapsing issue because of the curly braces. Using normal fluid syntax the whole structure is "invalid" and much more errors are thrown (duplicate id, unclodes div, etc.).

So what is the best way to edit TYPO3 fluid template files in PhpStorm? Is there a way to tell PhpStorm to ignore the curly braces and its content in html/xml tags?

2 comments
Comment actions Permalink

No way, sorry:( Please vote for http://youtrack.jetbrains.com/issue/WI-7895 (fluid support)


0
Comment actions Permalink

Thanks! I already voted for this issue on 2014-02-08 but added a comment.

1

Please sign in to leave a comment.