1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Difficulties with parent node variable

Discussion in 'XenForo Development Discussions' started by Luxus, Nov 4, 2012.

  1. Luxus

    Luxus Well-Known Member

    For selected forums I want to make their subforums appear like in any other boards rather than in a popup. For example, every subforum whose parent node has the ID of 10 should be removed from the popup and appear old school like beneth the name of the parent node.

    The default code is from the node_forum_level_2 template:

    Code:
                <div class="nodeStats pairsInline">
                    <xen:if is="{$renderedChildren} AND {$level} == 2">
                        <div class="Popup subForumsPopup">
                            <a href="{xen:link forums, $forum}" rel="Menu" class="cloaked" data-closemenu="true"><span class="dt">{xen:phrase sub_forums}:</span> {xen:number $forum.childCount}</a>
                 
                            <div class="Menu JsOnly subForumsMenu">
                                <div class="primaryContent menuHeader">
                                    <h3>{$forum.title}</h3>
                                    <div class="muted">{xen:phrase sub_forums}</div>
                                </div>
                                <ol class="secondaryContent blockLinksList">
                                <xen:foreach loop="$renderedChildren" value="$child">
                                    {xen:raw $child}
                                </xen:foreach>
                                </ol>
                            </div>
                        </div>
                    </xen:if>
                </div>
    I tried adding this just to test if the conditional works:


    Code:
                <div class="nodeStats pairsInline">
                    <xen:if is="{$renderedChildren} AND {$level} == 2">
                    <xen:if is="{$parent.node_id} == 10">
                        <div class="classicSubforums">Test message to see if this works</div>
                    <xen:else />
                        <div class="Popup subForumsPopup">
                            <a href="{xen:link forums, $forum}" rel="Menu" class="cloaked" data-closemenu="true"><span class="dt">{xen:phrase sub_forums}:</span> {xen:number $forum.childCount}</a>
                 
                            <div class="Menu JsOnly subForumsMenu">
                                <div class="primaryContent menuHeader">
                                    <h3>{$forum.title}</h3>
                                    <div class="muted">{xen:phrase sub_forums}</div>
                                </div>
                                <ol class="secondaryContent blockLinksList">
                                <xen:foreach loop="$renderedChildren" value="$child">
                                    {xen:raw $child}
                                </xen:foreach>
                                </ol>
                            </div>
                        </div>
                    </xen:if>
                    </xen:if>
                </div>
    But it didn't work. Granted I don't even know if there is a $parent.node_id variable. No results found when I searched for this, so any help is greatly appreciated.

    Edit: Never mind. I edited the wrong template and used an non-existing variable. The right variable to use is $category.node_id.
     
    Marcus likes this.

Share This Page