我的内容类型的自定义模板在Drupal 7 - Bootstrap主题中不起作用

问题描述:

I am using bootstrap theme on Drupal 7. My subtheme has some templates that have overwritten certain pages.

I am trying to make a template specifically for one of my content types:

Spokesmodel Page (Machine name: spokesmodel_page)

I have a template named page--spokesmodel_page.tpl.php but for some reason it's not showing up. I've cleared the cache and written a line of code for testing to see if it works but it's getting the template from page.tpl.php

Is there something else I need to do for this to work or should it automatically start working? I've made templates for certain nodes and they work fine.

我在Drupal 7上使用bootstrap主题。我的subtheme有一些模板覆盖了某些页面。 p>

我正在尝试专门为我的某个内容类型制作模板: p>

Spokesmodel页面(计算机名称:spokemodel_page) p> 我有一个名为 页面的模板 - spokemodel_page.tpl.php strong>但由于某种原因它没有显示出来。 我已经清除了缓存并编写了一行代码用于测试,看看它是否有效,但它从 page.tpl.php获取模板 strong> p>

是否有 我需要做些什么才能让它工作或者它应该自动开始工作? 我为某些节点制作了模板,它们工作正常。 p> div>

Try copying node.tpl.php from the parent theme into the child theme and re-naming that according to naming conventions here https://www.drupal.org/node/1089656

i.e. node--spokesmodel.tpl.php

The page tpl is not what you're looking for. Assuming the content you have is a basic page, the way to override the template is to use node--page.tpl.php.

You'll have to check if the current page is the one you want and then do the changes you require as this tpl is used by all content of type page.