Hi.

I just started making my theme, and i want to stylize maintenance page. I found some solutions by searching but it seems that they fit for 5.x. As i'm dealing with 6.x they don't for for me. Because as i understand something in theming maintenance page has changed. Can anybody enlighten me? I want to override theming of maintenance page in my theme (tempalte), i don't want to hack core. Thanks

Comments

vm’s picture

add a custom maintenance-page.tpl.php to your theme

see the one in garland for example

noovot’s picture

okay, i just copied it, because it seems to not have any garland tails

nothing happened

i tried to loook through garland's template.php - there's nothing that looks like maintenance (override or kinda)

i feel it's somewhere in includes/themes.maintenance.inc but where...?

dvessel’s picture

The registry doesn't factor into maintenance pages but that is the only exception.

joon park

dvessel’s picture

Get that maintenance-page.tpl.php into your theme then look inside your "settings.php" file. There will be notes on maintenance themes.

The way the new theming system is handled, makes this necessary. A nice bonus though is that if your database crashes, you can also add "maintenance-page-offline.tpl.php" to show a friendly page with your branding intact.

joon park

Sandoz’s picture

That does work well if the mysql DB is offline, but maintenance-page.tpl.php isn't parsed when the DB is online and the site mode is offline--page.tpl.php is called instead.

dvessel’s picture

You have to log-out. It's only supposed to be visible for anonymous users.

http://drupal.org/node/195435

joon park

Sandoz’s picture

Any way to override that?

dvessel’s picture

To be more clear.. Users without administration privileges will see the offline page. Administrators seeing that screen would lock them out forever.

joon park
–the devil in the details–

Macronomicus’s picture

Does not work for me, followed the instructions in the docs .. seems simple enough. That hack below is looking very tempting!

Macronomicus’s picture

I forgot to uncomment the closing line of the $conf thingy. Oops ^_^
also I got tripped up by not including both
maintenance-page-offline.tpl.php
maintenance-page.tpl.php

Now I just need to find the hook to call the off-line message set in the admin, and this will be perfect!

NecroHill’s picture

change in the includes\theme.maintenance.inc (line 46):
$theme = variable_get('maintenance_theme', 'minnelli');

to
$theme = variable_get('maintenance_theme', 'YOUR_THEME');

do not forget to put your changed maintenance-page.tpl.php file in the root folder of your theme

vm’s picture

you shouldn't hack core files, it's not a best practice. Using the settings.php method insures that when your site is updated the changes are left intact. The method above means, you will have to make this same change multiple times.

kevinr1247’s picture

I've been working on this for hours....

hacking the core file is the ONLY way I could get this to work. The documentation for this is very problematic IMO. Tried everything short of my final solution.

Wolfflow’s picture

Hi, reading this Post i had somehow a clue.

Can you not add to your custom maintenance-page.tpl.php an "if" statement that when the "variable_get('maintenance_theme' == "minnelli", change to "Your_Theme" ?

I'm really unknown of PHP it's really only a pure ultra-beginners curiosity.
I just thing that might be the logical sequence to not fork or hack Drupal-Core for obviously
future update-processing.

Cheers

P.S.
JUst deleted my link to a homepage that do not exist anymore. (15.06.2008)

Contact me for drupal projects in English, German, Italian, Drupal Hosting Support.

abato’s picture

For the love of god.... I cant get this to work after I upgraded... Working with theme "marvin".

I copied the template.tpl.php to chameleon directory

then I change settings. I have tried both (line 185)

 $conf = 'maintenance_theme' => 'marvin',

and

 $conf = ['maintenance_theme'] => 'marvin',

and

'maintenance_theme' => 'marvin',

None if this worked so I went to theme.maintance.inc and changed on line 46

    $theme = variable_get('maintenance_theme', 'marvin');

whatever I do, when site is off line the viewer gets:

Parse error: syntax error, unexpected T_DOUBLE_ARROW in /var/www/dzidzo.dk/public_html/sites/default/settings.php on line 185

PLS: Any help would be much appreciated.
Regards

1phatdj’s picture

Hi, i figured out a nifty way to change my maintenance page without messing with any configuration whatsoever. Go into the Garland theme folder in your drupal installation, copy the maintanance-page.tpl.php to your computer and edit the heck out of it. Then, rename the garland's original one as something else, like maintenance-page.tpl-old.php, and upload your new one in its place. it will automatically take it up and i pretty much took a html page which i'm using as the "coming soon" page for a client.

Hope this way works out for you, and let me know if you have any questions; oh by the way i'm in drupal 6.3.

darumaki’s picture

Jesus fraken bush, you would think the drupal team could have made this any more difficult :)

simplybrad’s picture

I got the same error.

I fixed it by ending the variable by inserting " ); " after 'maintenance_theme' => 'marvin',

Hueij’s picture

Make sure you have a maintenance-page.tpl.php file in your theme folder. Then edit your sites/default/settings.php file:

...
 $conf = array /* Removed the hash sign */
...
 'maintenance_theme' => 'yourThemeName',  /* Removed the hash sign */
...
 ); /* Removed the hash sign, line 213 or whereabouts */
...

www.opstijgendenevel.nl

krakerjak’s picture

This is what needs to be done.

But it still didn't work yet
to get my custom maintenance page going, I had to create a copy of
maintenance-page.tpl.php
called
maintenance-page-offline.tpl.php
in my sites/themes/-mytheme- folder

AS well as disabling the garland theme from the admin menu as it was always defaulting
to the garland maintenance theme even with the changes made to settings.php

sammys’s picture

Hi there,

I've had to look into this for a project i'm working on and here's what i've found.

Drupal core lacks a way to select which theme is to be used for the maintenance page (i.e some way of setting the variable 'maintenance_theme' through the admin interface). To set this variable without modifying settings.php one simply runs the following query:

INSERT INTO variable (name, value) VALUES ('maintenance_theme', 's:7:"mytheme";');

You need to replace the "mytheme" with the name of your theme (leaving the double quotes there), and replace the 7 with the number of letters in the name of your theme. E.g for a theme called blahblah it would be 's:8:"blahblah";'.

The above query does the same thing as adding the following to settings.php:

$conf = array(
  'maintenance_theme' => 'mytheme',
);

Another thing I came across is the maintenance theme doesn't show the color changes made using the color module. E.g if you do make customizations to the colors of the garland theme your maintenance page will still show up as the default blue. Workaround is to put the following into the theme's template.php:

/**
 * Override maintenance page variables.
 */
function phptemplate_preprocess_maintenance_page(&$vars) {
  // Hook into color.module
  if (function_exists('_color_page_alter')) {
    _color_page_alter($vars);
  }
}

I've had to use function_exists() instead of module_exists() because the system reports color.module as NOT existing in maintenance mode even though the functions are available.

--
Sammy Spets
Synerger Pty Ltd
http://synerger.com

kaido.toomingas’s picture

First I would like to thank you all... I looked the same solution. I tried things whats you said would help. When I could not get to work... Then I read some in settings.php .

There is now need to hack core. I made this mistake, when I started with Drupal, but now I will be smarter with other systems too :)

Just remove some # before these lines and its working well :)

$conf = array(
'theme_default' => 'minelli', //--- you can set up new default theme even for install site :) //---
'maintenance_theme' => 'minelli', //--- minelli replaced with mytheme name//---
); //--- This must be there too :) //---

www.web3.ee
Under construction, but will be my best so far :)

SDM-MINK’s picture

I am new to Drupal, so I am probably making a mistake. I am trying to change the Theme of my Drupal 6 maintenance page so that it matched the theme (mytheme) that I am using for my site (Theming the Drupal 6 maintenance page - http://drupal.org/node/195435).

I tried to followed the instructions shown in http://drupal.org/node/195435. Here are the problems that I had:

1. Got message that sites/default/settings.php was password protected so that I could not make changes to this file. So I made changes to the sites/default/default.settings.php. However, when I went to upload the modified file onto my server, I received a message indicating that sites/default/ was locked and thus would not accept this modified file. So I guess I don't know how to hack into this, which I am uncomfortable doing anyhow.

2. Am I to save the new file maintenance-page.tpl.php in theme/mytheme or write over the file located in modules/system?

3. I could not find any directions as to how to modify modules/system/maintenance.css. I assume that I should take my style.css (in theme/mytheme), rename it maintenance.css then write over the file located in modules/system. Is this correct?

However, since I could not perform 1 above, I am still using the default ("minnelli") maintenance page.

Any assistance is much appreciated! Thanks!

kaido.toomingas’s picture

1. default.settings.php - does not give you this effect
2.settings.php - remove # marks from these lines and change theme name...

$conf = array(
 'maintenance_theme' => 'your-theme-name',
);

3. when settings.php could not be writeble then look your server- administration panel and change the file rights... or when you got online file editor you can make changes in there.

maintenance-page.tpl.php should be in themes/mytheme directory
there is no need to write new css file.. you can add new rules to style.css file

I personaly did like this... copied and renamed page.tpl.php to maintenance-page.tpl.php and it works without new css rules :)

www.web3.ee - Will come soon

Costum webdesign, consulting and SEO for Drupal in Estonia.

vm’s picture

1. these are file and folder permissions. Using an FTP tool, inspect the permissions on the default folder, note them, then change the permissions to 777 do the same with the settings.php file

after you alter your settings.php and upload it, change the permissions back to what they were.

2. in your theme folder

3. incorrect. copy maintenance.css to your theme folder and alter it there.

aterchin’s picture

yeah, it's pretty simple:
1. duplicate your theme's page.tpl.php file, rename to maintenance-page.tpl.php, make the changes to that.
2. do the settings.php change
3. lastly, remember to clear the cache, either at admin/settings/performance or with devel module.

Rob T’s picture

My maintenance theme is perfect. Thank you rpmute and kaido24 for a solid solution.

fehin’s picture

Subscribing.

GaO’s picture

up

as a beginner I've taken Garland template to make some tests,
I've changed the colors and a new folder has been created:

sites/default/files/color/garland-ac243135/

How my maintenance-tpl.php can load this folder ?

I've made the changes in settings.php, and it well activated while the site is off-line,
but not the custom colors from 'garland-ac243135' folder.

what's the trick please ?

vm’s picture

sites/default/files/color is where the current color changes are stored when using the core colorpicker module to change the look of garland. maintenance-page.tpl.php goes into your theme folder. Then you must clear your theme registry for the new tpl.php file to be picked up. Garland comes with maintenance-page.tpl.php file. Nothing else should have needed to be done with reference to settings.php in garland for a maintenance-page.tpl.php file to work properly.

GaO’s picture

May I ask you how to clear the theme registry pls ?

vm’s picture