I've read the post here (http://drupal.org/node/235463) and took the 2nd option, but for some reason it simply will not work.

Does it matter that I'm using a Zen subtheme? I've set everything up to what I believe is correct. Any help would be greatly appreciated.

Comments

harrisben’s picture

Sorry, I sometimes forget that others don't have full knowledge of what I'm doing.

I am using a Zen subtheme on Drupal 6.2 and would like to redirect to a specific html file when the site is set to maintenance mode. The second option on http://drupal.org/node/235463 seemed like the perfect choice, but after making the changes to template.php of my zen sub-theme I find that it doesn't work and I'm not quite sure why.

Update #1:

I've realised my settings.php was pointing to the wrong maintenance theme, but adjusting that hasn't fixed it (yet).

Update #2:

and I've come full circle, realising that the problem was just a simple matter of case (ie Offline.html vs. offline.html). I did need to update settings.php though, so I guess it wasn't all me.

Sorry to waste anyones time.

cog.rusty’s picture

From what I can see in http://api.drupal.org/api/function/theme_maintenance_page/5 there is no Drupal 6 tab, so this function has been dropped (as have many things which used to be done in a template.php file)

However I think the first method has become much easier:
http://api.drupal.org/api/file/themes/garland/maintenance-page.tpl.php/6

harrisben’s picture

It might be worth explaining exactly what I did so that others who may also need to know will find it a little easier in the future.

My purpose was to display a specific html page when site maintenance was activated, because I personally disliked the way the site maintenance page is handled in Drupal.

Following the good advice at http://drupal.org/node/235463 (I selected the 2nd option), I added the following code into my template.php:

function phptemplate_maintenance_page($content, $messages, $partial) {
  drupal_goto('path/to/your/site-offline.html');
}

One of my later discoveries was that it should actually be:

function phptemplate_maintenance_page($content, $messages = TRUE, $partial = FALSE) {
  drupal_goto('path/to/you/site-offline.html');
}

Even after doing all of this I was still getting garland theme and plain old maintenance page that I didn't want. As I am not even using the Garland theme (I use Zen), I knew something was still wrong somewhere.

The solution was found at http://drupal.org/node/195435. The default theme drupal uses for maintenance is the Garland theme, irrespective of whatever theme settings you may have. This can be changed by editing your settings.php and adding the following code at the end of the file:

<?php
$conf['maintenance_theme'] = 'themeName';
?>

NOTE: both the /site/default/ directory and the settings.php file are write protected by default.

If you're not like me and don't make the mistake of naming your file incorrectly it should now work.

Despite there being no entry on http://api.drupal.org under Drupal 6 for the phptemplate_maintenance_page() function, it still exists in Drupal 6 and works perfectly.

cog.rusty’s picture

That was was probably an omission in the API documentation, because this entry for 6.x

http://api.drupal.org/api/function/template_preprocess_maintenance_page/6

still talks about invoking theme_maintenance_page()

darumaki’s picture

$conf['maintenance_theme'] = 'themeName';

It should be without the php tags if its settings shouldn't it ?

I still have issues getting it to work, this sucks, drupal 5 it worked perfecly

harrisben’s picture

I'd be happy to 'try' to help if you can provide some details as to where exactly you're stuck.

darumaki’s picture

I got it working, had to sift through several threads until it made sense.

jtjones23’s picture

I keep getting a parsing error ("Parse error: syntax error, unexpected T_STRING in...") if I add the rediriect code to my template.php file. The error is on the drupal_goto line.

I'm supposed to add the code to the template.php file in my new theme? Correct?

Drupal 6.4, using a Zen subtheme

cog.rusty’s picture

The answer is probably in the error message. "Unexpected T_STRING in..." which file, which line, what code?

jtjones23’s picture

I don't know what happen...I went to lunch, came back and tried to recreate the error to answer your questions and the code works just fine.

I'm baffled.

JohnFilipstad’s picture

I do not know your motivations in using an alternate maintenance page. If I should guess, it may be because you do not like how it looks like and what it contains. If so, here is a link on how to theme the default maintenance page for Drupal 6:

Documentation > Theming Guides > Theme guide (Drupal 6) > Theming the maintenance page

Cheers,
John
----------------------
Drupal Norge
hvor oversettere, brukere, utviklere og leverandører av Drupal i Norge samles