MyBB Community Forums

Full Version: (Notn a plugin, etc) Need help with switchingskins by time..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I've inserted this code into my header, but something is wrong:

<?php 
if (date("g") >= 6 && date("A") == "PM") 
{ 
    echo" 
    <style> 
    body { background: #3e2452; color: #000; font-family: Verdana; font-size: 13px; text-align: center; /* IE 5 fix */ line-height: 1.4 } a:link { color: #361b4a; text-decoration: none; } a:visited { color: #361b4a; text-decoration: none; } a:hover, a:active { color: #404040; text-decoration: underline; } #container { width: 83%; background: #fff; border: 1px solid #231230; color: #000000; margin: auto auto; padding: 20px; text-align: left; /* IE 5 fix */ } #content { /* FIX: Make internet explorer wrap correctly */ width: auto !important; } .menu ul { color: #000000; font-weight: bold; text-align: right; padding: 4px; } .menu ul a:link { color: #000000; text-decoration: none; } .menu ul a:visited { color: #000000; text-decoration: none; } .menu ul a:hover, .menu ul a:active { color: #4874a3; text-decoration: none; } #panel { background: #643b84; color: #ffffff; font-size: 11px; border: 1px solid #351b49; padding: 8px; text-align: center; } #panel a:link { color: #ffffff; } #panel a:visited { color: #ffffff; } #panel a:hover, #panel a:active { color: #ffffff; } table { color: #000000; font-family: Verdana; font-size: 13px; } .tborder { background: #ffffff; width: 100%; margin: auto auto; border: 1px solid #010101; } .thead { background: #643b84 url(../images/crystalpurple/head.gif) top left repeat-x; color: #ffffff; padding: 6px; } .thead a:link { color: #ffffff; text-decoration: none; } .thead a:visited { color: #ffffff; text-decoration: none; } .thead a:hover, .thead a:active { color: #ffffff; text-decoration: underline; } .tcat { background: #d7d7d7 url(../images/crystalpurple/subhead.gif) top left repeat-x; color: #643b84; font-size: 12px; } .tcat a:link { color: #643b84; } .tcat a:visited { color: #643b84; } .tcat a:hover, .tcat a:active { color: #643b84; } .trow1 { background: #efefef; } .trow2 { background: #efefef; } .trow_shaded { background: #eea8a1; } .trow_sep { background: #e5e5e5; color: #000; font-size: 12px; font-weight: bold; } .tfoot { background: #643b84 url(../images/crystalpurple/head.gif) top left repeat-x; color: #ffffff; } .tfoot a:link { color: #ffffff; text-decoration: none; } .tfoot a:visited { color: #ffffff; text-decoration: none; } .tfoot a:hover, .tfoot a:active { color: #ffffff; text-decoration: underline; } .bottommenu { background: #643b84; color: #ffffff; border: 1px solid #351b49; padding: 6px; } .bottommenu a:link { color: #ffffff; } .bottommenu a:visited { color: #ffffff; } .bottommenu a:hover, .bottommenu a:active { color: #ffffff; } .navigation { color: #000000; font-size: 13px; font-weight: bold; } .navigation a:link { text-decoration: none; } .navigation a:visited { text-decoration: none; } .navigation a:hover, .navigation a:active { text-decoration: none; } .navigation .active { color: #000000; font-size: small; font-weight: bold; } .smalltext { font-size: 11px; } .largetext { font-size: 16px; font-weight: bold; } input.textbox { background: #ffffff; color: #000000; border: 1px solid #351b49; padding: 1px; } textarea { background: #ffffff; color: #000000; border: 1px solid #351b49; padding: 2px; font-family: Verdana; line-height: 1.4; font-size: 13px; } select { background: #ffffff; border: 1px solid #351b49; } .editor { background: #f1f1f1; border: 1px solid #ccc; } .editor_control_bar { background: #fff; border: 1px solid #351b49; } .toolbar_normal { background: #f0f0f0; border: 1px solid #f0f0f0; } .toolbar_hover { background: #f5f5f5; border: 1px solid #cccccc; } .toolbar_clicked { background: #cccccc; border: 1px solid #b3b3b3; } .autocomplete { background: #fff; border: 1px solid #351b49; color: black; } .autocomplete_selected { background: #643b84; color: #ffffff; } .popup_menu { background: #ffffff; border: 1px solid #351b49; } .popup_menu .popup_item { background: #efefef; color: #000; } .popup_menu .popup_item:hover { background: #643b84; color: #ffffff; } .trow_reputation_positive { background: #ccffcc; } .trow_reputation_negative { background: #ffcccc; } .reputation_positive { color: green; } .reputation_neutral { color: #444; } .reputation_negative { color: red; } /* Additional CSS (Master) */ img { border: none; } .clear { clear: both; } .hidden { display: none; float: none; width: 1%; } .float_left { float: left; } .float_right { float: right; } .menu ul { list-style: none; margin: 0; } .menu li { display: inline; padding-left: 5px; } .menu img { padding-right: 5px; vertical-align: top; } #panel .links { margin: 0; float: right; } .expcolimage { float: right; width: auto; vertical-align: middle; } img.attachment { border: 1px solid #E9E5D7; padding: 2px; } .pagenav { font-weight: bold; } .pagenavbit { padding-left: 3px; } .pagenavbit a { text-decoration: none; } .pagenavcurrent { font-weight: bold; padding-left: 3px; } hr { background-color: #000000; color: #000000; height: 1px; border: 0px; } #copyright { font: 11px Verdana, Arial, Sans-Serif; margin: 0; padding: 10px 0 0 0; } #debug { float: right; text-align: right; margin-top: 0; } .quote_header { background: #fff; border: 1px dashed #000; border-bottom: 0; color: #000; font-weight: bold; margin: 8px auto 0 auto; padding: 4px; } .quote_body { background: #fff; border: 1px dashed #000; border-top: 0; color: #000; padding: 4px; margin: 0 auto 8px auto; } .code_header { background: #fff; border: 1px dashed #000; border-bottom: 0; color: #000; font-weight: bold; margin: 8px auto 0 auto; padding: 4px; } .code_body { background: #fff; border: 1px dashed #000; border-top: 0; color: #000; padding: 4px; margin: 0 auto 8px auto; font-family: Monaco, Consolas, Courier, monospace; font-size: 12px; } .usercpnav { list-style: inside; padding: 0; margin: 0; } .usercpnav li { padding: 1px; font-size:11px } .usercpnav .pmfolders { /* PM folders on the UCP Nav menu */ } .subforumicon { border: 0; vertical-align: middle; } .separator { margin: 5px; padding: 0; height: 0px; font-size: 1px; list-style-type: none; } form { margin: 0; padding: 0; } .popup_menu .popup_item_container { margin: 1px; text-align: left; } .popup_menu .popup_item { display: block; padding: 3px; text-decoration: none; white-space: nowrap; } .popup_menu a.popup_item:hover { text-decoration: none; } .autocomplete { text-align: left; } /* Additional CSS (Custom) */ .logo { background: #643b84; border: 1px solid #351b49; text-align: center; } 
    </style> 
    "; 
} 
?> 


From 6:00 PM to 11:59 PM, the "Crystal Purple" skin [Created by Belloman should display. And it does, but there is a catch.

And the top of the screen, it displays this code.

= 6 && date("A") == "PM") { echo" "; } ?> 

Does anyone know what is wrong, and how I can correct this? Please respond if possible.
Bump.
You can't put PHP code in templates.
Yeah, I kind of figured that. If I recode it in Javascript, will it work then?
It has to work Wink
The template system does not accept php codes...
<script type="text/javascript">
var minutes = 1000*60
var hours = minutes*60
var days = hours*24
var years = days*365
var d = new Date()
var t = d.getTime()
var y = t/years
var asm = 0
var tt = 1
if (hours >= 12)
{
 var asm = 1
}

if (hours =< 11)
{
 var asm = 0
}



    document.write(" 
    <style> 
    body { background: #3e2452; color: #000; font-family: Verdana; font-size: 13px; text-align: center; /* IE 5 fix */ line-height: 1.4 } a:link { color: #361b4a; text-decoration: none; } a:visited { color: #361b4a; text-decoration: none; } a:hover, a:active { color: #404040; text-decoration: underline; } #container { width: 83%; background: #fff; border: 1px solid #231230; color: #000000; margin: auto auto; padding: 20px; text-align: left; /* IE 5 fix */ } #content { /* FIX: Make internet explorer wrap correctly */ width: auto !important; } .menu ul { color: #000000; font-weight: bold; text-align: right; padding: 4px; } .menu ul a:link { color: #000000; text-decoration: none; } .menu ul a:visited { color: #000000; text-decoration: none; } .menu ul a:hover, .menu ul a:active { color: #4874a3; text-decoration: none; } #panel { background: #643b84; color: #ffffff; font-size: 11px; border: 1px solid #351b49; padding: 8px; text-align: center; } #panel a:link { color: #ffffff; } #panel a:visited { color: #ffffff; } #panel a:hover, #panel a:active { color: #ffffff; } table { color: #000000; font-family: Verdana; font-size: 13px; } .tborder { background: #ffffff; width: 100%; margin: auto auto; border: 1px solid #010101; } .thead { background: #643b84 url(../images/crystalpurple/head.gif) top left repeat-x; color: #ffffff; padding: 6px; } .thead a:link { color: #ffffff; text-decoration: none; } .thead a:visited { color: #ffffff; text-decoration: none; } .thead a:hover, .thead a:active { color: #ffffff; text-decoration: underline; } .tcat { background: #d7d7d7 url(../images/crystalpurple/subhead.gif) top left repeat-x; color: #643b84; font-size: 12px; } .tcat a:link { color: #643b84; } .tcat a:visited { color: #643b84; } .tcat a:hover, .tcat a:active { color: #643b84; } .trow1 { background: #efefef; } .trow2 { background: #efefef; } .trow_shaded { background: #eea8a1; } .trow_sep { background: #e5e5e5; color: #000; font-size: 12px; font-weight: bold; } .tfoot { background: #643b84 url(../images/crystalpurple/head.gif) top left repeat-x; color: #ffffff; } .tfoot a:link { color: #ffffff; text-decoration: none; } .tfoot a:visited { color: #ffffff; text-decoration: none; } .tfoot a:hover, .tfoot a:active { color: #ffffff; text-decoration: underline; } .bottommenu { background: #643b84; color: #ffffff; border: 1px solid #351b49; padding: 6px; } .bottommenu a:link { color: #ffffff; } .bottommenu a:visited { color: #ffffff; } .bottommenu a:hover, .bottommenu a:active { color: #ffffff; } .navigation { color: #000000; font-size: 13px; font-weight: bold; } .navigation a:link { text-decoration: none; } .navigation a:visited { text-decoration: none; } .navigation a:hover, .navigation a:active { text-decoration: none; } .navigation .active { color: #000000; font-size: small; font-weight: bold; } .smalltext { font-size: 11px; } .largetext { font-size: 16px; font-weight: bold; } input.textbox { background: #ffffff; color: #000000; border: 1px solid #351b49; padding: 1px; } textarea { background: #ffffff; color: #000000; border: 1px solid #351b49; padding: 2px; font-family: Verdana; line-height: 1.4; font-size: 13px; } select { background: #ffffff; border: 1px solid #351b49; } .editor { background: #f1f1f1; border: 1px solid #ccc; } .editor_control_bar { background: #fff; border: 1px solid #351b49; } .toolbar_normal { background: #f0f0f0; border: 1px solid #f0f0f0; } .toolbar_hover { background: #f5f5f5; border: 1px solid #cccccc; } .toolbar_clicked { background: #cccccc; border: 1px solid #b3b3b3; } .autocomplete { background: #fff; border: 1px solid #351b49; color: black; } .autocomplete_selected { background: #643b84; color: #ffffff; } .popup_menu { background: #ffffff; border: 1px solid #351b49; } .popup_menu .popup_item { background: #efefef; color: #000; } .popup_menu .popup_item:hover { background: #643b84; color: #ffffff; } .trow_reputation_positive { background: #ccffcc; } .trow_reputation_negative { background: #ffcccc; } .reputation_positive { color: green; } .reputation_neutral { color: #444; } .reputation_negative { color: red; } /* Additional CSS (Master) */ img { border: none; } .clear { clear: both; } .hidden { display: none; float: none; width: 1%; } .float_left { float: left; } .float_right { float: right; } .menu ul { list-style: none; margin: 0; } .menu li { display: inline; padding-left: 5px; } .menu img { padding-right: 5px; vertical-align: top; } #panel .links { margin: 0; float: right; } .expcolimage { float: right; width: auto; vertical-align: middle; } img.attachment { border: 1px solid #E9E5D7; padding: 2px; } .pagenav { font-weight: bold; } .pagenavbit { padding-left: 3px; } .pagenavbit a { text-decoration: none; } .pagenavcurrent { font-weight: bold; padding-left: 3px; } hr { background-color: #000000; color: #000000; height: 1px; border: 0px; } #copyright { font: 11px Verdana, Arial, Sans-Serif; margin: 0; padding: 10px 0 0 0; } #debug { float: right; text-align: right; margin-top: 0; } .quote_header { background: #fff; border: 1px dashed #000; border-bottom: 0; color: #000; font-weight: bold; margin: 8px auto 0 auto; padding: 4px; } .quote_body { background: #fff; border: 1px dashed #000; border-top: 0; color: #000; padding: 4px; margin: 0 auto 8px auto; } .code_header { background: #fff; border: 1px dashed #000; border-bottom: 0; color: #000; font-weight: bold; margin: 8px auto 0 auto; padding: 4px; } .code_body { background: #fff; border: 1px dashed #000; border-top: 0; color: #000; padding: 4px; margin: 0 auto 8px auto; font-family: Monaco, Consolas, Courier, monospace; font-size: 12px; } .usercpnav { list-style: inside; padding: 0; margin: 0; } .usercpnav li { padding: 1px; font-size:11px } .usercpnav .pmfolders { /* PM folders on the UCP Nav menu */ } .subforumicon { border: 0; vertical-align: middle; } .separator { margin: 5px; padding: 0; height: 0px; font-size: 1px; list-style-type: none; } form { margin: 0; padding: 0; } .popup_menu .popup_item_container { margin: 1px; text-align: left; } .popup_menu .popup_item { display: block; padding: 3px; text-decoration: none; white-space: nowrap; } .popup_menu a.popup_item:hover { text-decoration: none; } .autocomplete { text-align: left; } /* Additional CSS (Custom) */ .logo { background: #643b84; border: 1px solid #351b49; text-align: center; } 
    </style> 
    "); 

</script>


What is wrong with this script then?
Try this:

<script type="text/javascript">
var minutes = 1000*60
var hours = minutes*60
var days = hours*24
var years = days*365
var d = new Date()
var t = d.getTime()
var y = t/years
var asm = 0
var tt = 1
if (hours >= 12)
{
 var asm = 1
}

if (hours <= 11)
{
 var asm = 0
}



    document.write(" 
    <style> 
    body { background: #3e2452; color: #000; font-family: Verdana; font-size: 13px; text-align: center; /* IE 5 fix */ line-height: 1.4 } a:link { color: #361b4a; text-decoration: none; } a:visited { color: #361b4a; text-decoration: none; } a:hover, a:active { color: #404040; text-decoration: underline; } #container { width: 83%; background: #fff; border: 1px solid #231230; color: #000000; margin: auto auto; padding: 20px; text-align: left; /* IE 5 fix */ } #content { /* FIX: Make internet explorer wrap correctly */ width: auto !important; } .menu ul { color: #000000; font-weight: bold; text-align: right; padding: 4px; } .menu ul a:link { color: #000000; text-decoration: none; } .menu ul a:visited { color: #000000; text-decoration: none; } .menu ul a:hover, .menu ul a:active { color: #4874a3; text-decoration: none; } #panel { background: #643b84; color: #ffffff; font-size: 11px; border: 1px solid #351b49; padding: 8px; text-align: center; } #panel a:link { color: #ffffff; } #panel a:visited { color: #ffffff; } #panel a:hover, #panel a:active { color: #ffffff; } table { color: #000000; font-family: Verdana; font-size: 13px; } .tborder { background: #ffffff; width: 100%; margin: auto auto; border: 1px solid #010101; } .thead { background: #643b84 url(../images/crystalpurple/head.gif) top left repeat-x; color: #ffffff; padding: 6px; } .thead a:link { color: #ffffff; text-decoration: none; } .thead a:visited { color: #ffffff; text-decoration: none; } .thead a:hover, .thead a:active { color: #ffffff; text-decoration: underline; } .tcat { background: #d7d7d7 url(../images/crystalpurple/subhead.gif) top left repeat-x; color: #643b84; font-size: 12px; } .tcat a:link { color: #643b84; } .tcat a:visited { color: #643b84; } .tcat a:hover, .tcat a:active { color: #643b84; } .trow1 { background: #efefef; } .trow2 { background: #efefef; } .trow_shaded { background: #eea8a1; } .trow_sep { background: #e5e5e5; color: #000; font-size: 12px; font-weight: bold; } .tfoot { background: #643b84 url(../images/crystalpurple/head.gif) top left repeat-x; color: #ffffff; } .tfoot a:link { color: #ffffff; text-decoration: none; } .tfoot a:visited { color: #ffffff; text-decoration: none; } .tfoot a:hover, .tfoot a:active { color: #ffffff; text-decoration: underline; } .bottommenu { background: #643b84; color: #ffffff; border: 1px solid #351b49; padding: 6px; } .bottommenu a:link { color: #ffffff; } .bottommenu a:visited { color: #ffffff; } .bottommenu a:hover, .bottommenu a:active { color: #ffffff; } .navigation { color: #000000; font-size: 13px; font-weight: bold; } .navigation a:link { text-decoration: none; } .navigation a:visited { text-decoration: none; } .navigation a:hover, .navigation a:active { text-decoration: none; } .navigation .active { color: #000000; font-size: small; font-weight: bold; } .smalltext { font-size: 11px; } .largetext { font-size: 16px; font-weight: bold; } input.textbox { background: #ffffff; color: #000000; border: 1px solid #351b49; padding: 1px; } textarea { background: #ffffff; color: #000000; border: 1px solid #351b49; padding: 2px; font-family: Verdana; line-height: 1.4; font-size: 13px; } select { background: #ffffff; border: 1px solid #351b49; } .editor { background: #f1f1f1; border: 1px solid #ccc; } .editor_control_bar { background: #fff; border: 1px solid #351b49; } .toolbar_normal { background: #f0f0f0; border: 1px solid #f0f0f0; } .toolbar_hover { background: #f5f5f5; border: 1px solid #cccccc; } .toolbar_clicked { background: #cccccc; border: 1px solid #b3b3b3; } .autocomplete { background: #fff; border: 1px solid #351b49; color: black; } .autocomplete_selected { background: #643b84; color: #ffffff; } .popup_menu { background: #ffffff; border: 1px solid #351b49; } .popup_menu .popup_item { background: #efefef; color: #000; } .popup_menu .popup_item:hover { background: #643b84; color: #ffffff; } .trow_reputation_positive { background: #ccffcc; } .trow_reputation_negative { background: #ffcccc; } .reputation_positive { color: green; } .reputation_neutral { color: #444; } .reputation_negative { color: red; } /* Additional CSS (Master) */ img { border: none; } .clear { clear: both; } .hidden { display: none; float: none; width: 1%; } .float_left { float: left; } .float_right { float: right; } .menu ul { list-style: none; margin: 0; } .menu li { display: inline; padding-left: 5px; } .menu img { padding-right: 5px; vertical-align: top; } #panel .links { margin: 0; float: right; } .expcolimage { float: right; width: auto; vertical-align: middle; } img.attachment { border: 1px solid #E9E5D7; padding: 2px; } .pagenav { font-weight: bold; } .pagenavbit { padding-left: 3px; } .pagenavbit a { text-decoration: none; } .pagenavcurrent { font-weight: bold; padding-left: 3px; } hr { background-color: #000000; color: #000000; height: 1px; border: 0px; } #copyright { font: 11px Verdana, Arial, Sans-Serif; margin: 0; padding: 10px 0 0 0; } #debug { float: right; text-align: right; margin-top: 0; } .quote_header { background: #fff; border: 1px dashed #000; border-bottom: 0; color: #000; font-weight: bold; margin: 8px auto 0 auto; padding: 4px; } .quote_body { background: #fff; border: 1px dashed #000; border-top: 0; color: #000; padding: 4px; margin: 0 auto 8px auto; } .code_header { background: #fff; border: 1px dashed #000; border-bottom: 0; color: #000; font-weight: bold; margin: 8px auto 0 auto; padding: 4px; } .code_body { background: #fff; border: 1px dashed #000; border-top: 0; color: #000; padding: 4px; margin: 0 auto 8px auto; font-family: Monaco, Consolas, Courier, monospace; font-size: 12px; } .usercpnav { list-style: inside; padding: 0; margin: 0; } .usercpnav li { padding: 1px; font-size:11px } .usercpnav .pmfolders { /* PM folders on the UCP Nav menu */ } .subforumicon { border: 0; vertical-align: middle; } .separator { margin: 5px; padding: 0; height: 0px; font-size: 1px; list-style-type: none; } form { margin: 0; padding: 0; } .popup_menu .popup_item_container { margin: 1px; text-align: left; } .popup_menu .popup_item { display: block; padding: 3px; text-decoration: none; white-space: nowrap; } .popup_menu a.popup_item:hover { text-decoration: none; } .autocomplete { text-align: left; } /* Additional CSS (Custom) */ .logo { background: #643b84; border: 1px solid #351b49; text-align: center; } 
    </style> 
    "); 

</script>


The code from the CSS file might be overwriting the css in your script.
Okay, now I tried putting that code into the CSS file, and it still doesn't work. What is wrong with it?
Bump.
putting Javascript in CSS files won't work, I'm pretty sure. Try putting the code after the css link tag in the header template.
http://img.photobucket.com/albums/v734/C...c/7786.jpg

Which one? I went into header include and put the code below the "Link Rel" tag, but nothing happened.
Pages: 1 2