Nesting template conditionals

Lee

Well-known member
Code:
<xen:if is="{$forum.node_id} != 30">
    <xen:if is="{$canPostThread}">
        <xen:set var="$newDiscussionButton"><a href="{xen:link 'forums/create-thread', $forum}" class="callToAction"><span>Sell an Item</span></a></xen:set>
        <xen:if is="!{$renderedNodes}">
            <xen:topctrl>{xen:raw $newDiscussionButton}</xen:topctrl>
        </xen:if>
    <xen:elseif is="{$visitor.user_id}" />
        ({xen:phrase no_permission_to_post})
    <xen:else />
        <label for="LoginControl"><a href="{xen:link login}" class="concealed">({xen:phrase log_in_or_sign_up_to_post})</a></label>
    </xen:if>
<xen:else />
    <xen:if is="{$canPostThread}">
        <xen:set var="$newDiscussionButton"><a href="{xen:link 'forums/create-thread', $forum}" class="callToAction"><span>Sell an Item</span></a></xen:set>
        <xen:if is="!{$renderedNodes}">
            <xen:topctrl>{xen:raw $newDiscussionButton}</xen:topctrl>
        </xen:if>
    <xen:elseif is="{$visitor.user_id}" />
            ({xen:phrase no_permission_to_post})
    <xen:else />
            <label for="LoginControl"><a href="{xen:link login}" class="concealed">({xen:phrase log_in_or_sign_up_to_post})</a></label>
    </xen:if>
</xen:if>

I have the above in a template of my forum. But it doesn't seem to display anything.

What I want to do is show a different button for forum 30 to every other forum whilst still retain permission checks etc.

I have checked all tags etc and the syntax appears right, but for some reason nothing is displayed. But if you remove the permission checking like so:

Code:
<xen:if is="{$forum.node_id} != 30">
<xen:if is="{$canPostThread}">
    <xen:set var="$newDiscussionButton"><a href="{xen:link 'forums/create-thread', $forum}" class="callToAction"><span>{xen:phrase post_new_thread}</span></a></xen:set>
    <xen:if is="!{$renderedNodes}">
        <xen:topctrl>{xen:raw $newDiscussionButton}</xen:topctrl>
    </xen:if>
</xen:if>
<xen:else />
<xen:if is="{$canPostThread}">
    <xen:set var="$newDiscussionButton"><a href="{xen:link 'forums/create-thread', $forum}" class="callToAction"><span>Sell an Item</span></a></xen:set>
    <xen:if is="!{$renderedNodes}">
        <xen:topctrl>{xen:raw $newDiscussionButton}</xen:topctrl>
    </xen:if>
</xen:if>
</xen:if>

Then it works fine.

Any body any ideas? :)
 
I found another, much simpler way of doing this.

I'll post it up next time I am in my admin control panel, in case anybody wants to do the same thing.
 
Top Bottom