2011-03-10 49 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和在同等條件下分類長期的工作,但我已經看到它使用了幾次改變模板/在一定條件下的主題基地)

相關問題