By PakWaan on
Where is the "Site offline" page located? I would like to change it to include my graphic logo instead of the default Druplicon graphic. I'm sure it's simple, but I can't find the code that generates the page.
Where is the "Site offline" page located? I would like to change it to include my graphic logo instead of the default Druplicon graphic. I'm sure it's simple, but I can't find the code that generates the page.
Comments
Look in misc/maintenance.css
Look in misc/maintenance.css . The message can be configured from the settings page.
hth,
-K
I figured out how to replace
I figured out how to replace the logo by changing the default background in maintenance.css from "druplicon.png" to my logo file.
However, the "Site Offline" wording starts in the middle of my logo - I would like to be able to move the positioning of the words an inch or two down the page - where can the positioning be changed for the text?
It's in common.inc, line
It's in common.inc, line 280.
Regards
Patrick Nelson
=================================================================
All truth goes through three stages:
- First, it is ridiculed,
- Then it is violently opposed,
- And finally it is accepted as self-evident
http://www.vcommunity.org.uk
Line 280 in RC2 is a 403
Line 280 in RC2 is a 403 error message.
I did find this at line 241:
But I don't see where it would allow me to move the positioning of the variable 'site_offline_message' further down the page.
Same file
Change the margins and padding in maintenance.css to suit your taste.
--
If you have a problem, please search before posting a question.
Which CSS tag corresponds to
Which CSS tag corresponds to where it places the 'site_offline_message' variable? I want to move that text about 1-1/2" down the page.
do it in themes file?
Hey guys, I'm new to Drupal and need to do the same. I want the off-line page customized like the rest of the theme but don't want to mess with the core files.
So, is it possible to do it from the template? I searched the API docs and it seems possible. Just don't know how to implement it since I'm not a coder.
Here are a list of links I found relevant:
http://drupaldocs.org/api/head/function/_menu_site_is_offline
http://drupaldocs.org/api/head/function/drupal_site_offline
http://drupaldocs.org/api/head/function/theme_maintenance_page
http://drupaldocs.org/api/head/function/drupal_maintenance_theme
Thanks-
-joon
www.dvessel.com
Oh, and to answer your
Oh, and to answer your question.. There are no tags to control the message. The lines below were generated from 4.7rc3.
But we do have the h1 tag which is what you want anyways. Increase the top margin to push anything below it down further.
The order goes this way
margin: top right bottom left;so, in the next lines taken from maintenance.css the top margin is 1.6em.-joon
www.dvessel.com
Isn't this a lot of
Isn't this a lot of unnecessary trouble? Why not just upload your logo (saved in png format) to the misc directory and rename it druplicon.png? No core or css editing needed. -- Just a thought.
---
Of course one could do it that way, however when the site is indexed, now you'd have someone elses logo named drupalicon which wouldn't make any real sense.
The way you are suggesting would be kinda hackish and while being a working hack, woudln't be the proper way to do it.
Your dragging upa topic a year old : ) not sure if you knew that or not.
Do it in your theme
I see nobody has actually answered this question in a way that newbies would understand. So I thought I would take a crack at it, even if it is a really old post.
In your includes/theme.inc file is a function called theme_maintenance_page().
To override the output of the default site offline page all you need to do is copy that function and its contence to your template.php file in your theme. Then rename the file to phptemplate_maintenance_page() and then any changes you make to the contents of that function will be visible and you don’t have to hack core in any way.
Here are some links to the handbook pages to help you with this.
Using Theme Override Functions http://drupal.org/node/55126
template.php: Overriding other theme functions http://drupal.org/node/11811
If you not a php developer and you don’t feel comfortable hacking php code but don’t mind using phpTemplate then here is an example of what you could do.
Use the following in your template.php file. (This is a 5.x example)
Then create the following file and save it in your theme directory (the same directory as your template.php file) as site-offline.tpl.php.
Now you can make changes to your
site-offline.tpl.phpfile the same way you would make changes to yourpage.tpl.phpfile or yournode-<node-type>.tpl.phpfiles.Hope somebody finds that useful.
Works a treat!
Did the above on my 5.2 installation and works great.
As a newbie I had a bit of head scratching to figure out how to override maintenance.css without hacking.
Very easy in the end - just created my own css file in my theme directory and changed the
misc/maintenance.csspath in mymytheme_maintenance_page()function.Many thanks!
Here's another article that might help:
http://www.mattfarina.com/2007/03/26/creating-custom-drupal-maintenance-...
Wish List Addition?
As a REALLY new user to Drupal AND PHP/CSS, this looks not only difficult, but dangerous. I think the Drupal developers should include this in their installations/maintenance routines so it can be changed by the installer. How about adding this to the "Wish List" for the next release. Should be an easy update, eh Drupal?
Kidbyte
=-=
dangerous ?
the only way something like this makes it into core is if a proper patch is created and added to the issue query by a user and it's checked over by a developer and then they choose to add it. Ideally, core is kept small for a reason. The smaller core, the smaller the footprint. Not everyone will want to change the image. Fact is if you really, really wanted to change it, you can just find it in the misc folder and replace the graphic with one of your own, naming it the same as what's already there.
This is not really that
This is not really that difficult or dangerous. I see how a new user that knows nothing about PHP could find this very scary, but it’s not dangerous. Because you are only changing your theme for one page that is not always visible, it has no real impact on your site. Generally you would test things like this before you make them live. If you follow the instructions exactly the PHP stuff is just a copy past. When it comes to the site-offline.tpl.php file you can do what ever you want. You can make it a static html file without all the embedded PHP stuff. The template.php file is at the heart of drupals theme system, without it themers loose a lot of flexibility.
But I see where you are coming from, drupal is not that easy to use if you don’t really know PHP. You can do a lot if you stick to the contrib themes and modules but if you want to do more than what’s already available, then knowing PHP becomes important. Maybe thats why many developers see drupal as a framework, rather than an out the box CMS, but this is slowly changing. You can see this in the changes to the theme system (http://drupal.org/node/132442).
It must be mentioned, as it's
It must be mentioned, as it's not quite clear or obvious, that when you perform this template override, you require to go to ~/admin/settings/site-maintenance and bounce your site back to online mode then again to offline mode. Only then _will_ your changes will take effect.
subscribing
subscribing
________________
Live fast die young
Adding this to a zen subtheme in Drupal 5
Here is a updated version to use in a Zen subtheme's template.php
Note: I am using a local version of the maintenance.css in my theme folder by calling path_to_subtheme()
So in my theme folder I have added the code to template.php
I have a new file called maintenance.css with my custom css
I also have a new file site-offline.tpl.php with my custom page info as in NaX's comment
zen subtheme 5.x maintenance messages (fixed) with Google Cache
This version fixes a problem with relative paths returned from
path_to_subtheme()when the maintenance page is shown for internal site pages.I've also added a snippet to the end of the
$contentthat refers the user to a Google cached version of the requested page if its a node or the frontpage.Alternatively, you could leave the template.php code as is, and place the Google Cache link stuff in the
site-offline.tpl.phpfile if you dont need to worry about translatable strings....Another method ...
Hey, don't know if this is good or bad but I wanted a somewhat fancier "coming soon" page with some links, etc.
My solution was to create a simple html page, outside the drupal framework, then change these lines (323,324) in common.inc ...
to ...
hope that helps someone.
=-=
hacking a core file, even if minimally is frowned upon. Each and every update or upgrade you would have to make the same adjustment to core code. Thus avoiding doing this as above is advised.
_____________________________________________________________________
Confucius says:
"Those who seek drupal answers should use drupal search!" : )
You can do this without hacking core
You can do this without hacking core by modifying the example in http://drupal.org/node/58562#comment-266358
Here are 2 possible examples ways of doing this.
Include your html file, that should be in your theme dir
Redirect to your html file.
But I would recommend using drupals redirect function. See http://api.drupal.org/api/function/drupal_goto/5
Re: You can do this without hacking core
Thank you, this worked very nicely. For any other total beginners I'll point out NaX's code goes into a (new) file in your templates directory called template.php ... that one took me a while to figure out.
Drupal continues to be a learning experience .. thanks again.
=-=
some themes already have a template.php, if your theme doesn't have a template.php you create one.
_____________________________________________________________________
Confucius says:
"Those who seek drupal answers should use drupal search!" : )
hi, i have done exactly as
hi,
i have done exactly as you suggested but i still get the same page.
I am using 5.7.
Any ideas what can be the error?
hi, i finaly made it work
hi,
i finaly made it work and thank you for the help.
Just one small tip which might not be so important
if you use
header('Location: /where/your/file/is.html');or
drupal_goto('/where/your/file/is.html');then you are redirected in the offline page.
If in the mean time the site comes online and you refresh your page you will still see the offline message since you url points to the offline page.
if you use
require_once 'site-offline.html';you dont have such problem so i think this method is better.
small a stupid maybe but it got me confused for a second
page not refreshing...
I tried adding this to template.php, but no luck, so I reverted to my original template. php file and made do by simply changing what the logo in maintenance.css points to and using the ability to add a message in the "Site maintenance" window.
Strange thing, even though I've reverted to my old template.php, the changes I make aren't coming through in my browser, despite the fact that when I look at it on another machine it's fine.
What do I have to do to be able to see my newly-edited maintenance mode page on my own machine?
Thanks, all -- LW
Try following this example
Try following this example http://drupal.org/node/58562#comment-266358
Also have a look at this docs page that references this thread. http://drupal.org/node/235463
But it sounds like you have a browser cache problem.
The maintenance page is
The maintenance page is cached in cache_page if you have you have that enabled in Performance.
Truncate that table or whatever you use to clear the site cache.
for the 5.3-update I finally
for the 5.3-update I finally also need to set some pages to offline - and of course I would also like to have a themed off-page..:] ..I actually already found what I was looking for (the theme_function will do) but still couldn't resist to suggest if this 'link/to/offline/page.html' could also be a nice feature for upcoming drupal versions.. There is already the "front page" option provided by the front-page-module - why not make it a core functionality to have an alternative "online start page" and an "offline start page"..? I would just love to see such a feature in dp-6, 7, 8...:]
greetz, till..
___________________________
my pictures: www.bilderbook.org
___________________________
On localhost
On localhost site-offline.tpl.php works but on the server it's not displaying the offline message even though the files are the same
Thank-you Nax
Two excellent methods for doing this!
I created a small handbook page to document these two approaches: http://drupal.org/node/235463
What about maintenance-page.tpl.php
With Drupal 6 if you create a maintenance-page.tpl.php (Based on your theme's page.tpl.php) and go to
sites/default/settings.php(Make writable if necessary).And Around line 170, update the code:
$conf['maintenance_theme'] = 'themename';//You should be all set, and you can make any customizations to the template file as needed.