XF 1.5 Check the content template from within node_list?

Nulumia

Well-known member
Searched some similar threads but none of them hit the mark.

When rendering the node list, XF1.5 doesn't distinguish between whether it's on forum_list or discussion_list (Both use the same code in node_list template)

I'd like to add some additional classes to the ol list:
<ol class="nodeList sectionMain here" id="forums">

.. but only on the forum_list. If I use <xen:if is="{$contentTemplate} == 'forum_list'"></xen:if>, it works within PAGE_CONTAINER but not within node_list. Is there any way to perform this conditional here?
 
You can make a variable that only works for that template
in forum_list template find:
Code:
<xen:hook name="forum_list_nodes">
    <xen:if is="{$renderedNodes}"><xen:include template="node_list" /></xen:if>
</xen:hook>
and add something like this
Rich (BB code):
<xen:hook name="forum_list_nodes">
    <xen:if is="{$renderedNodes}"><xen:include template="node_list"><xen:set var="$myvar" value="forum_list" /></xen:include></xen:if>
</xen:hook>
for testing i added this to node_list template
Code:
{xen:helper dump, $myvar}
<xen:if is="{$myvar}">Forum list! :)
<xen:else />Not forum list :(</xen:if>
1511662593384.webp

1511662752815.webp
 
Last edited:
You can make a variable that only works for that template
in forum_list template find:
Code:
<xen:hook name="forum_list_nodes">
    <xen:if is="{$renderedNodes}"><xen:include template="node_list" /></xen:if>
</xen:hook>
and add something like this
Rich (BB code):
<xen:hook name="forum_list_nodes">
    <xen:if is="{$renderedNodes}"><xen:include template="node_list"><xen:set var="$myvar" value="forum_list" /></xen:include></xen:if>
</xen:hook>
for testing i added this to node_list template
Code:
{xen:helper dump, $myvar}
<xen:if is="{$myvar}">Forum list! :)
<xen:else />Not forum list :(</xen:if>
View attachment 162519

View attachment 162522
Very clever and simple method, thanks a ton!
This just freed up some other ideas/bottlenecks which could use it as well. (sorry for late response too)
 
  • Like
Reactions: DL6
Top Bottom