XF 2.0 Content only on the forum index

behaba62

New member
Hello,

I am a beginner on Xenforo 2 and I have not managed to find the answer in the documentation or on the forum. My newbie question is : how can I display a content only on the forum index within the template ? :D

Thanks for your help.

Have a good day.
 
Ok man, im sorry i don't understand fully what you're asking. Do you mean you want the forums section as index lol?
Or you're wanting to add a announcement? Message somewhere in index?
 
I just need to set a custom content on the forum index. I have used this but it does'nt work :

Code:
<xf:if is="$template =='forum_list'">
    my custom content
</xf:if>
 
Because I want to make this condition inside a macro :

Code:
<xf:macro name="sub_nodes_flat" arg-children="!" arg-childExtras="!" arg-depth="3">
    <xf:css src="node_list.less" />
    <xf:if contentcheck="true">
        <div class="node-subNodesFlat">
            <span class="node-subNodesLabel">{{ phrase('sub_forums:') }}</span>
            <ol class="node-subNodeFlatList">
            <xf:if is="$template =='forum_list'">
                <li>My custom content</li>
            </xf:if>
            <xf:contentcheck>
                <xf:macro template="forum_list" name="node_list"
                    arg-children="{$children}"
                    arg-extras="{$childExtras}"
                    arg-depth="{{ $depth + 1 }}" />
            </xf:contentcheck>
            </ol>
        </div>
    </xf:if>
</xf:macro>
 
In forum_list, right below:
HTML:
<xf:macro name="sub_nodes_flat" arg-children="!" arg-childExtras="!" arg-depth="3">
add
HTML:
<xf:set var="$childExtras.isList" value="true" />
In the node_list macro in the same template, add your check:
HTML:
<xf:if is="{$extras.isList}">
    <!-- do your stuff -->
    <xf:else />
    <!-- default stuff -->
</xf:if>
 
Back
Top Bottom