【问题标题】:Unable to add a new region to sub theme无法向子主题添加新区域
【发布时间】:2011-12-11 06:06:38
【问题描述】:

所以我有一个 Bartik 子主题用于我的网站。现在的想法是为这个主题添加一个自定义区域。我正在遵循以下描述的过程:

  1. 将自定义区域添加到 subtheme.info 文件中,例如:region['custom_region'] = Custom Region
  2. 添加到子主题的page.tpl.php页面:

这不起作用,并且在我检查自定义区域时不会出现。

我为 Bartik 主题(这是默认提供的主题)做了同样的事情,它工作正常,这意味着自定义区域出现在它应该出现的位置。

那么这里有什么可疑之处? :p

谢谢各位!

【问题讨论】:

  • 是否出现在后台的block页面中?

标签: drupal drupal-7 drupal-theming


【解决方案1】:

你不应该需要撇号。此外,您应该将区域定义为“区域” - 因此请在您的 .info 文件中尝试:

regions[custom_region] = Custom Region

祝你好运! :-)

【讨论】:

    【解决方案2】:

    在page.tpl.php页面插入:

    <?php if ($page['custom_region']): ?>
      <div id="custom_region">
        <?php print render($page['custom_region']); ?>
      </div>
    <?php endif; ?>
    

    并刷新所有缓存

    【讨论】:

    • 您好 Siteogra,感谢您的回答。我不确定这是否有效。通过简单地添加到 page.tpl.php 页面:
    猜你喜欢
    • 2023-03-10
    • 1970-01-01
    • 2023-02-12
    • 1970-01-01
    • 2019-04-04
    • 2020-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多