By Marc Bijl on
Currently I'm working at a Drupal 4.7.x website. As long as the site is in the development stage, I'll show the maintenance page. However, it doesn't look like the way I want it to. I know I can change the maintenance css file, but I want to customize the content as well.
Does someone know how to theme the maintenance page?
I've found some information here which refers to another page here, but unfortunately I don't get it...
A more step-by-step (let's say idiot proof :) explanation would be very much appreciated!
Cheers,
Marc
Comments
Ok i'm still a bit new to
Ok i'm still a bit new to themeing as well ..but as I understand it:
1) Looking at this page:
http://drupal.org/node/11811
we can see what the orginal looked like and what the themed peice that gets put in template.php looks like. The orginial got cut off when i viewed that page so i looked up the theme_item_list() and found the complete function:
http://api.drupal.org/api/4.7/function/theme_item_list
2) so using that same process to solve this problem, look up the theme_maintenance_page() function which can be found here:
http://api.drupal.org/api/4.7/function/theme_maintenance_page
we see what the orginal theme_maintenance_page() does... it uses the passed in variables to build the html neccessary to display the maitenance page.
Now the new phptemplate_item_list from the example sets up callback to tell phptemplate to use item_list.tpl.php to generate the output, the array is the variables that item_list.tpl.php has access to. This is really good for site maitenance sake, but I'll show you how to do it without the extra .tpl.php for now because its a bit simpler.
So...
Next copy the body of the theme_maintenance_page() function ( everything between but NOT including the first "{" and last "}" ). Open up template.php in your theme folder and create a new function at the end like this:
Now just modify the php to generate the html into the $output variable that you want....
If you were curious on how to do this with that .tpl.php file, read this:
http://drupal.org/node/11811#comment-28887
which explains it really well.
hope this helps. Someone please correct me if I said something incorrectly because i'm kind of new at this.
Thanks! You just made my day :)
Hi Steven,
Thanks very much for your great guidelines! With the excellent instructions I managed to set up another maintenance page within minutes. Wouldn't have thought it could be so easy...
Cheers mate!
CU,
Marc
___________________
discover new oceans
lose sight of the shore
Will themes work when DB is down
I want to change the status alert when the server can't connct to the database. But in my tests I can't get this to work via the theme changes. Which lead me think that if the PHP scripts can't communicate with the DB then it likely can't read look to see which theme files to load right? So if your messages page is supposed to show you a DB connection error you can't use themes to style this up right?
Am I missing something? I think I will end up just hacking the database.inc file to configure the DB down message.
I would love find a
I would love find a them-able way to do this. I can override the maintenance_theme.tpl.php but it doesn't take when the connection to the database is down. I ended up modifying the .inc file directly but since it's calling a print_theme function you'd think there would be a way to do it. Is there some type of fallback theme that it uses if it can't connect to the database?
themeing maintenance without database connection
I'm trying to do the same thing. What's the protocol for theming the mainenance page when you dont have a database connection?
Not.
--
If you have a problem, please search before posting a question.
Try this
There's a maintenance.css file in "misc" (at least in Drupal 5.1) that you can edit to include your logo etc. for the maintenance page.
Then edit the error text in the includes/database.myqsl.inc (or whatever database version you are using).
In 6.x
In Theme guide (Drupal 6) there is a description for how to do this with D6.
Edit: Don't forget to re"build" the theme, i.e. e.g. go to admin/build/themes, to actually see changes...