Drupal 7维护模式自定义页面不起作用

时间:2014-09-01 15:10:38

标签: drupal-7 maintenance-mode

前奏

  • Drupal 7
  • Bootstrap Business(活动主题)
  • 开启维护模式

我已执行的操作

  1. modules/system/maintenance-page.tpl.php
  2. 复制maintenance-page.tpl.php
  3. 根据您的需求进行编辑
  4. 将其粘贴到主题的根文件夹 - > /public_html/sites/all/themes/bootstrap-business
  5. /public_html/sites/default/settings.php中设置$ conf变量:$ conf ['maintenance_theme'] ='bootstrap_business';`
  6. 尽管如此,该网站仍在显示modules/system/maintenance-page.tpl.php。我不知道为什么它不起作用。我也试过了:

    • 添加maintenance-page--offline.page.tpl.php
    • 将主题名称设为bootstrap-business

    以上工作都没有。我不认为在这么简单的任务上花费45分钟就足够了。我知道我可以编辑modules/system/maintenance-page.tpl.php,但我不相信这是正确的方法。

    有什么建议吗?

1 个答案:

答案 0 :(得分:1)

清除/清除缓存(主题注册表缓存),然后重试。如果您已经这样做并且无效,请将页面预处理功能添加到您的默认主题 template.php

bootstrap_business_preprocess_maintenance_page(&$variables) {
  if (isset($variables['db_is_active']) && !$variables['db_is_active']) {
// Template suggestion for offline site
    $variables['theme_hook_suggestion'] = 'maintenance_page__offline';
  }
else {
// Template suggestion for live site (in maintenance mode)
    $variables['theme_hook_suggestion'] = 'maintenance_page';
 }
}

相关问题:https://drupal.stackexchange.com/q/76946/12163