2011-03-10 75 views

回答

0

在您的主题的template.php中:

/** 
* Override or insert variables into the page templates. 
* 
* @param $vars 
* An array of variables to pass to the theme template. 
*/ 
function YOURTHEMENAME_preprocess_page(&$vars) { 
    // ... 
    $node = $vars['node']; 
    if ($node && ($node->type=='story')) { 
    foreach ($node->taxonomy as $term) { 
     if ($term->name == 'SOMETAG1') { 
     $vars['template_files'][] = 'page-sometag1'; 
     break; 
     } 
     else if ($term->name == 'SOMETAG2') { 
     $vars['template_files'][] = 'page-sometag2'; 
     break; 
     } 
    } 
    } 
    // ... 
} 

用您的值替换大写字母。 page-sometag1.tpl.php和page-sometag2.tpl.php文件应位于您的主题文件夹中。

0

ThemeKey模块可能会这样做。

(不知道它可以同Content-Type和在同等条件下分类长期的工作,但我已经看到它使用了几次改变模板/在一定条件下的主题基地)

相关问题