Advertisement:

Author Topic: Custom Maintenance page  (Read 1362 times)

k33n

  • Newbie
  • *
  • Posts: 36
Custom Maintenance page
« on: March 27, 2015, 01:33:44 pm »
FYI
The best way to create your own custom maintenance page is to create a file called maintenance.php inside your theme root and start adding whatever you want there.
Ex:
Code: [Select]
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="<?php echo str_replace('_''-'osc_current_user_locale()); ?>">

    <head>

<?php osc_current_web_theme_path('head.php'); ?>


    </head>

<body id="maintenance">
         
       <?php osc_current_web_theme_path('header.php') ; ?>

      <div id="main"></div>

     <?php osc_current_web_theme_path('footer.php'); ?>

</body>


For styling you can use your theme style.css and make sure you use an unique id for the page(#maintenance for the given example above)
Ex:
Code: [Select]
#maintenance {your style} //afects body
#maintenance #main {} //for main div
#maintenance p {} //you got the ideea

It worked pretty awesome for me  :)

obx19

  • Newbie
  • *
  • Posts: 23
Re: Custom Maintenance page
« Reply #1 on: May 21, 2015, 06:41:18 pm »
  I posted this a couple years ago


     Here is what I did.... In the index.php where the maintenance area is I just used a simple redirect...

if( file_exists(ABS_PATH . '.maintenance') ) {
        if(!osc_is_admin_user_logged_in()) {
            require_once LIB_PATH . 'osclass/helpers/hErrors.php';

                           $title   = sprintf(__('Maintenance &raquo; %s'), osc_page_title());
 Change Red ---   $message = sprintf(__('We are sorry for any inconvenience. %s is undergoing maintenance.') . '.', osc_page_title() );
    To----              $message = sprintf(__('<meta http-equiv="Refresh" content="0; url=http://www.yoursite.com">') . '.', osc_page_title() );

            header('HTTP/1.1 503 Service Temporarily Unavailable');
            header('Status: 503 Service Temporarily Unavailable');
            header('Retry-After: 900');
            osc_die($title, $message);

Hope this helps others...