Need help making Maintenance message better.....

Started by dougiefresh, October 05, 2014, 06:20:43 PM

Previous topic - Next topic

dougiefresh

I'm trying to write a mod that makes the Maintenance message better.  You know, the message where it says something like this:
QuoteMaintenance Mode
Okay faithful users...we're attempting to restore an older backup of the database...news will be posted once we're back!
when $maintenance is set to 2 in the Settings.php file.

In Errors.php, I've replaced this:
if (!empty($maintenance))
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="robots" content="noindex" />
<title>', $mtitle, '</title>
</head>
<body>
<h3>', $mtitle, '</h3>
', $mmessage, '
</body>
</html>';
// If this is a load average problem, display an appropriate message (but we still don't have language files!)
elseif ($loadavg)
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="robots" content="noindex" />
<title>Temporarily Unavailable</title>
</head>
<body>
<h3>Temporarily Unavailable</h3>
Due to high stress on the server the forum is temporarily unavailable.  Please try again later.
</body>
</html>';
// What to do?  Language files haven't and can't be loaded yet...
else
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="robots" content="noindex" />
<title>Connection Problems</title>
</head>
<body>
<h3>Connection Problems</h3>
Sorry, SMF was unable to connect to the database.  This may be caused by the server being busy.  Please try again later.
</body>
</html>';

with this:
if (!empty($maintenance))
{
$mtitle = $mtitle;
$mmessage = $mmessage;
}
// If this is a load average problem, display an appropriate message (but we still don't have language files!)
elseif ($loadavg)
{
$mtitle = 'Temporarily Unavailable';
$mmessage = 'Due to high stress on the server the forum is temporarily unavailable.  Please try again later.';
}
else
// What to do?  Language files haven't and can't be loaded yet...
{
$mtitle = 'Connection Problems';
$mmessage = 'Sorry, SMF was unable to connect to the database.  This may be caused by the server being busy.  Please try again later.';
}

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="Themes/default/css/index.css?fin20" />
<link rel="stylesheet" type="text/css" href="Themes/default/css/install.css?fin20" />
<meta name="robots" content="noindex" />
<title>', $mtitle, '</title>
</head>
<body>
<div id="header"><div class="frame">
<div id="top_section">
<h1 class="forumtitle">', $mbname, '</h1>
<img id="smflogo" src="Themes/default/images/smflogo.png" alt="Simple Machines Forum" title="Simple Machines Forum" />
</div>
</div></div>
<div id="content_section">
<div id="main_screen" class="clear">
<div class="panel">
<div style="max-height: 560px; overflow: auto;">
<h2>', $mtitle, '</h2>
<h3>', $mmessage, '</h3>
</div>
</div>
</div>
</div></div></div>
<div id="footer_section"><div class="frame" style="height: 40px;">
<div class="smalltext"><a href="http://www.simplemachines.org/" title="Simple Machines Forum" target="_blank" class="new_win">SMF &copy; 2013, Simple Machines</a></div>
</div></div>
</body>
</html>';

What I've got so far is the attached picture, which isn't quite right.  Can somebody help me make this look like it's actually supposed to look like it's an official part of the forum using the default theme?  Right now, it's that big blank spot that has the Maintenance message that bothers me....  Thanks.....

Antechinus

One problem is you're running into problems with the limitations of the default images. Tell me, why are you using non-default classes? It would be simpler to use existing ones.

dougiefresh

Quote from: Antechinus on October 05, 2014, 06:25:15 PM
One problem is you're running into problems with the limitations of the default images. Tell me, why are you using non-default classes? It would be simpler to use existing ones.
Cause I'm trying to assemble a very basic version of the default theme and I know it ain't right....  If it was "right", I wouldn't be asking for help.   :P  I can't figure out what I'm doing wrong.  Please help....

EDIT: I guess one of the problems is that I'm using non-default classes, but I don't know what to change them to....

Antechinus

Ok, so you're calling the default index.css anyway. Why not just use something like this?

<div id="content_section"><div class="frame">
<div id="main_content_section">
<div class="cat_bar">
<h3 class="catbg">', $mtitle, '</h3>
</div>
<p>', $mmessage, '</p>
</div>
</div></div>



dougiefresh

I think I figured out what I was "doing wrong"....  The white space appears before what I expected because there was nothing in the "user information" area of the page.  So I placed some additional code in there, as well as took your suggestion, Antechinus!  Thank you!

I put all of this in a mod and......  guess what.....  it doesn't wanna install!   :(  Even though the code to replace is copied straight from the Errors.php file.  This is annoying.....

Hj Ahmad Rasyid Hj Ismail

If you need a smart look, why don't you add a template for it like Errors.template.php and output all errors in it?

dougiefresh

This morning, it took 3 tries to get the mod to install.... 3rd time is the charm....  So now the mod makes the old maintenance mode code a separate function and no one calls it  :P

Marking this solved....  Thank you!

Advertisement: