【发布时间】:2014-09-16 17:54:49
【问题描述】:
在这里慢慢失去理智:
我需要为某个词汇的术语制作一个模板。我创建了一个子主题并尝试使用 theme_preprocess_page() (theme_preprocess_taxonomy_term() 不知何故从未被调用)。
template.php
function aura_sub2_preprocess_page(&$variables) {
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
$term = taxonomy_term_load(arg(2));
drupal_set_message( 'page__vocabulary__' . $term->vocabulary_machine_name );
$variables['theme_hook_suggestions'][0] = 'page__vocabulary__' . $term->vocabulary_machine_name;
}
}
如您所见,我什至覆盖了第一个用于测试目的的建议,但它没有任何改变。页面加载就像什么都没发生一样。 当我打开“mydomain.com/?q=en/myvocabulary/someterm”时,我收到状态消息“page__vocabulary__myvocabulary”。到目前为止一切顺利,但模板建议似乎被忽略了。 该模板位于该子主题的“主题”目录中。我尝试了“--”和“__”的所有可能组合,但无济于事。模板只包含这个,有问题吗?:
主题/页面--vocabulary--myvocabulary.tpl.php
<h1>MYVOCAB TEST</h1>
缓存每次都清空,没有变化。 :c
有什么想法吗?
【问题讨论】:
标签: drupal drupal-7 drupal-themes