Drupal 6 站点离线主题
每次在维护站点时,总是看到Drupal默认的离线主题,这时才会想到要定制自己的站点离线,一次一次的升级过后,还没有改。今日想起此事于是在drupal.org找到相关的文章:Theming the Drupal 6 maintenance page ,并按照文中的指导动手做。
步骤大致如下:
复制你的主题目录下的page.tpl.php 两个副本并重命名为:maintenance-page.tpl.php 和 maintenance-page-offline.tpl.php,并根据自己的需要修改模板文件和风格
然后编辑站点的 settings.php 文件,通常位于 /sites/default 目录下
将行184的内容
修改为:
将行196的内容
修改为:
注意将theme_NAME替换为你的主题名字
将行225的内容
修改为:
然后到“管理-->站点设置-->站点维护"(URL:/admin/settings/site-maintenance)将站点切换到“离线”。
登出后看看结果怎样。此时应用的模板应该是 maintenance-page.tpl.php
接着把MYSQL服务器停掉,再刷新一下页面,此时应用的模板应该是 maintenance-page-offline.tpl.php
如果你收到MYSQL链接的错误信息,可以编辑站点的 settings.php 文件,通常位于 /sites/default 目录下
找到:
在其下面添加代码:
你可以根据自己的需要设置maintenance-page-offline.tpl.php模板
在文章:Theming the Drupal 6 maintenance page给出的例子,将下面代码添加到maintenance-page-offline.tpl.php文件的顶部
$head_title = 'mysite.com :: Site-offline';
$logo = 'sites/all/files/customLogo.png';
// If your theme is set to display the site name, uncomment this line and replace the value:
// $site_name = 'Your Site Name';
// If your theme is set to *not* display the site name, uncomment this line:
unset($site_name);
// If your theme is set to display the site slogan, uncomment this line and replace the value:
$site_slogan = 'My Site Slogan';
// If your theme is set to *not* display the site slogan, uncomment this line:
// unset($site_slogan);
// Main message. Note HTML markup.
$content = '<p>The site is currently not available due to technical problems. Please try again later. Thank you for your understanding.</p><hr /><p>If you are the maintainer of this site, please check your database settings.</p>';
?>
我是按照以上步骤试验成功,你呢,成功了吗?
评论
第一眼一看感觉很复杂,不敢试了
第一眼一看感觉很复杂,不敢试了。免得没事折腾出事情来。
发表新评论