[SOLVED] Check in template if nodeType is [instanceof/child-of ...]

Hi,
probably a completely strange idea, but I would like to differentiate in fluid template

  • if node is instance of an particular superType.

I hope this would enable to write mixin-templates. Those would reduce maintenance and error. No rewriting all-time same peaces of template-code …

Have found the necessary SuperTypes into {node.nodetype.superTypes}. So I guess the information would be available in template.

Perhaps someone would have a hint, how I could check the array keys easiest on a match? Is there some tricky/easy solution in the condition-part of fluid-template possible:

#Like
<f:if condition="{(Array.indexOf(Array.keys(node.nodetype.superTypes), 'Vendor.Site:searchSuperType') > -1)}"></f:if>

#OR maybe is it possible to use EEL-Filter in template like: 

'[instanceof Vendor.Site:searchSuperType]'

Unfortunately I can’t find a working solution on my own. Tried tons of combinations, and parts with {blabla.blabla -> f:debug()}, without usable output. Also with condition="{blabla.blabla}" no success.

Nope there is no way. You could implement a very simple ViewHelper to accomplish that or alternatively check the type in Fusion and give the result to the template.

Thanks for reply. No more docu-digging :wink:. Next I will try with ViewHelper.