First of all thanks for your work on this very needed project.

I wanted to override node.tpl.php file for a specific non-forum node, following this tip: http://drupal.org/node/136647

This worked fine, but now I have problems with Advanced Forum: Only the comments get themed properly, while the main post (node) doesn't get themed.

This is an extract from my template.php (the theme is Aurora):


function _phptemplate_variables($hook, $vars = array()) {
  if (module_exists('advanced_forum')) {
    $vars = advanced_forum_addvars($hook, $vars);
  }
  switch ($hook) {
    // Send a new variable, $has_terms, to see wether the current node has any terms
    case 'node':
      if(count(taxonomy_node_get_terms($vars['node']->nid)))
        $vars['has_terms'] = TRUE;
      else
        $vars['has_terms'] = FALSE;
      $vars['template_files'] = array('node-'. $vars['nid']);
      break;
  }

  return $vars;
}

The problem disappears when i remove the line $vars['template_files'] = array('node-'. $vars['nid']); but then I'm unable to theme individual nodes. I hope that someone could give me a hand with this, since I'm not a coder, but I'm trying to learn.

Comments

Michelle’s picture

Well, you're telling it to use a different template file for all your nodes so, yeah, that's going to hit your forum nodes, too. Put the call to advforum at the end of the function and it should take control back for forum nodes.

Michelle

trupalizer’s picture

Status: Active » Closed (fixed)

Thank you for your help, Michelle. Now I've got it working.

Juho

Michelle’s picture

Cool. :)

Michelle