1
我加入以下到我的template.php文件中,在[THEMENAME] _preprocess_page功能:的Drupal 7不使用模板建议
<?php
if ($variables['is_front'])
{
$variables['theme_hook_suggestions'] = array();
$variables['theme_hook_suggestions'][] = 'page__index';
}
if (isset($variables['node'])) {
// If the node type is "blog" the template suggestion will be "page--blog.tpl.php".
$variables['theme_hook_suggestions'][] = 'page__'. str_replace('_', '--', $variables['node']->type);
}
如果我运行$变量阵列上的var_dump,我可以看到在我的头版上,'theme_hook_suggestions'被设置为只使用'page__index'。我有一个名为'page - index.tpl.php'的文件。 Drupal仍然使用page.tpl.php。
我也注释掉了上面的代码,并将该文件重命名为'page - front.tpl.php',它仍然使用page.tpl.php。每次更改后我都清除缓存。
我错过了什么?
编辑:为了帮助澄清,我想覆盖前面页面的整个设计 - 没有列或侧边栏,不同的图形,一些div的不同背景等。我不想覆盖'node - '模板文件(还)。最后,我需要一个静态的首页,其设计与网站其他部分不同,然后是每个内容类型的自定义节点模板。