Friday, January 14, 2011

Three easy steps to customize logo and message in Site Offline Page in Drupal 5

1. In template.php create a function

function phptemplate_maintenance_page($content, $messages = TRUE, $partial = FALSE) {
$title = drupal_get_title();
$head_title = strip_tags($title);
$head = drupal_get_html_head();
$js = drupal_get_js();
$content = $content;
$message = ($messages ? theme('status_messages') : '');
return _phptemplate_callback('maintenance-page', array('content' => $content, 'title' => $title, 'head_title' => $head_title, 'head' => $head, 'js' => $js,'message' => $message));
}



2. Create maintenance-page.tpl.php and there you can print all the variables, that you passed through _phptemplate_callback in template.php.

e.g.
print $content; //prints the site-offline message that is entered in the site maintenance page in your site.
print $title;

3. Create a maintenance.css inside the theme you are using and include it in maintenance-page.tpl.php . In maintenance.css add your own css to customize your site offline page.

Thanks, hope I am clear and hope it helps to customize your site offline page with custom message and logos.

Ashraf