1. 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?

Discussion in 'XenForo Questions and Support' started by Floren, Mar 22, 2012.

  1. Floren

    Floren Well-Known Member

    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:
    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.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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
    		));
    	}
    
     
    Floren likes this.
  3. Floren

    Floren Well-Known Member

    Thanks Jake. :)
     

Share This Page