News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

"if" expression - Maintenance Page.

Started by bmgxc9, March 03, 2015, 11:21:12 AM

Previous topic - Next topic

bmgxc9

Hello! I am working on my forums $maintenance = 1; & maintenance = 2; pages. My idea is that the "1" level maintenance page will display a different message than the "2" level page.

I was thinking that this could be a accomplished via a simple if/else expression, but that didn't seem to work. Maybe I just didn't create the code correctly.

If anybody has any potential advice or resolutions, please share. Thank you.

Shambles

Show us the code you tried and we'll have a look for you :)

bmgxc9

########## Maintenance ##########
# Note: If $maintenance is set to 2, the forum will be unusable!  Change it to 0 to fix it.
$maintenance = 2; # Set to 1 to enable Maintenance Mode, 2 to make the forum untouchable. (you'll have to make it 0 again manually!)

if ($maintenance = 2)
echo
$mtitle = '<center><b>Maintenance Mode [BETA to 0.8.A]</center></b>'; # Title for the Maintenance Mode message.
$mmessage = '<body background="http://www.leftistvoice.com/portal/background-done.jpg"><center>
<img src="http://leftistvoice.com/portal/Themes/skyline_20a/images/custom/logo.png"><p>
Pardon our mess, we are currently developing LeftistVoice.com!<br>
The website will return to functionality soon, please check back later.</p>
<p><i>~ LeftistVoice.com Staff</i></p>'; # Description of why the forum is in maintenance mode.

if ($maintenance = 1)
echo
$mtitle = 'Maintenance Mode [BETA to 0.8.A]'; # Title for the Maintenance Mode message.
$mmessage = '<center>
Pardon our mess, we are currently developing LeftistVoice.com!<br>
The website will return to functionality soon, please check back later.</p>
<p><i>~ LeftistVoice.com Staff</i></p>'; # Description of why the forum is in maintenance mode.


It is parsing the if maintenance = 1 code as if the forum is in Maintenance 1, even though I have the initial string set to 2.

bmgxc9

I apologize, I am pretty new to the PHP game. Disregard the echo command, I realized that is unneeded.

Shambles

Try this code:

########## Maintenance ##########
# Note: If $maintenance is set to 2, the forum will be unusable!  Change it to 0 to fix it.
$maintenance = 2; # Set to 1 to enable Maintenance Mode, 2 to make the forum untouchable. (you'll have to make it 0 again manually!)

if ($maintenance == 2) {
$mtitle = '<center><b>Maintenance Mode [BETA to 0.8.A]</center></b>'; # Title for the Maintenance Mode message.
$mmessage = '<body background="http://www.leftistvoice.com/portal/background-done.jpg"><center>
<img src="http://leftistvoice.com/portal/Themes/skyline_20a/images/custom/logo.png"><p>
Pardon our mess, we are currently developing LeftistVoice.com!<br>
The website will return to functionality soon, please check back later.</p>
<p><i>~ LeftistVoice.com Staff</i></p>'; # Description of why the forum is in maintenance mode.
}
else if ($maintenance == 1) {
$mtitle = 'Maintenance Mode [BETA to 0.8.A]'; # Title for the Maintenance Mode message.
$mmessage = '<center>
Pardon our mess, we are currently developing LeftistVoice.com!<br>
The website will return to functionality soon, please check back later.</p>
<p><i>~ LeftistVoice.com Staff</i></p>'; # Description of why the forum is in maintenance mode.
}

bmgxc9


Advertisement: