To all you programmers out there:

I have found two snippets of php code for function _phptemplate_variables and would like to use both of them.
Since I am not a trained programmer I have been fiddling around for about an hour trying to combine the two under one function to no avail. Please could you help me combine the following two:

1).

function _phptemplate_variables($hook, $vars = array()) {
  switch ($hook) {
    case 'node':
      $vars['template_files'] = array('node-'. $vars['nid']);
      break;
  }
  return $vars;
}

2).

function _phptemplate_variables($hook, $vars) {
  if ($hook == 'page') {

    if ($secondary = menu_secondary_local_tasks()) {
      $output = '<span class="clear"></span>';
      $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
      $vars['tabs2'] = $output;
    }

    // Hook into color.module
    if (module_exists('color')) {
      _color_page_alter($vars);
    }
    return $vars;
  }
  return array();
}

I can't get them both working at the same time.

Help appreciated. Thanks

Comments

sylvie_n’s picture

OK, I've figured it out. As follows:

function _phptemplate_variables($hook, $vars = array()) {

  switch ($hook) {
    case 'node':
      $vars['template_files'] = array('node-'. $vars['nid']);
      break;
  }
if ($hook == 'page') {
 if ($secondary = menu_secondary_local_tasks()) {
      $output = '<span class="clear"></span>';
      $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
      $vars['tabs2'] = $output;
    }

    // Hook into color.module
    if (module_exists('color')) {
      _color_page_alter($vars);
    }}
    return $vars;
  }
return array();