[英]cannot get drupal 7 to recognize a page template for a content type
我有一个drupal 7网站,我想在其上制作二级头版。 问题是“ page--front.tpl.php”是两列布局,而“ page.tpl.php”是一列布局。 如果我使用节点模板,则将其推入一列的主体中。
主题名称为“出口”,内容类型的机器名称为“登陆”,但是当我尝试钩住页面时(登陆方式与我执行节点的方式相同),登陆不会发生。 没有。
我正在清除缓存,并在每次更改模板文件时都硬刷新页面。
我在“ page.tpl.php”中尝试过的一个代码
function egress_preprocess_page(&$vars) {
global $node;
if ($node->type == 'landing') {
$vars['theme_hook_suggestions'] = array('page__landing');
}
}
另一个
function egress_preprocess_page(&$vars) {
if ($vars['node']->type == "landing_page") {
$vars['template_files'][] = 'page--landing';
}
}
任何想法吗?
以下内容应转到您主题的template.php而不是page.tpl.php
function egress_preprocess_page(&$vars) {
// For page--(node-type).tpl.php
if (isset($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__'. $vars['node']->type;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.