XF 1.5 Template - xen:if inside xen:include inside xen:container not working

Mouth

Well-known member
With this code ...
Code:
<xen:container var="$head.openGraph"><xen:include template="open_graph_meta">
    <xen:set var="$url">-- url --</xen:set>
    <xen:set var="$title">-- title --</xen:set>
    <xen:set var="$description">-- description --</xen:set>
    <xen:if is="-- condition --">
        <xen:set var="$avatar">-- value 1 --</xen:set>
    <xen:else />
        <xen:set var="$avatar">-- value 2 --</xen:set>
    </xen:if>
</xen:include></xen:container>

... the xen:if is not working (being evaluated). If I remove the xen:set var="$avatar" outside the xen:if, then it's being handled appropriately.

How would I adjust the above code so that the xen:if is evaluated and handled?
 
Include is one of various "special" tags in that it doesn't directly render its children -- set is a special case for it. You'd either need to move your if+set outside the include. (Note that include will automatically have access to all variables in the scope.) Or, you move your if inside the $avatar set tag.
 
Back
Top Bottom