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

XF 1.1 $contentTemplate not eval'ed in node_forum_level_2?

Floren

Well-known member
#1
Hi guys,

I'm trying to apply some conditionals in 'node_forum_level_2' template:
Code:
<xen:if is="{$contentTemplate} == 'forum_list'">
Do some stuff
</xen:if>
For some reason, $contentTemplate evals to an empty string. I've put that code just below the line:
<xen:require css="node_forum.css" />
and it printed nothing while viewing the forum home or a specific forum that had sub-forums.
Can you please let me know if it does the same for you?

I'm looking for a solution to validate in 'node_forum_level_2' template if the forum list is viewed.
 

Jake Bunce

XenForo moderator
Staff member
#2
Requires a code change:

library/XenForo/NodeHandler/Forum.php

Add the red code:

Code:
	public function renderNodeForTree(XenForo_View $view, array $node, array $permissions,
		array $renderedChildren, $level
	)
	{
		$templateLevel = ($level <= 2 ? $level : 'n');

		return $view->createTemplateObject('node_forum_level_' . $templateLevel, array(
			'contentTemplate' => $view->getTemplateName(),
			'level' => $level,
			'forum' => $node,
			'renderedChildren' => $renderedChildren
		));
	}