Nick(NR)
|
Live Time Component?After a great deal of tweaking, I feel this component is now template ready per forum(have tested), Thanks to Brandon for pointing out I didn't close the script tags(don't know how I missed that).
An example can be seen here:
http://portalogy.myfastforum.org/index.php
I'd like some feedback before admin makes a decision, if he feels that this component will be worth adding, then I will send the code, there will however need to be a small template edit(one piece of code needs to be added to the overall_header), but I will detail how to do it, if the component gets green lighted.
|
admin (no pm's please)
|
I'd be happy to make that an official component.
|
Nick(NR)
|
Open up the overall_header.tpl, the following needs to be placed inside the body tag:
onLoad="show_clock()"
so it should look something like this:
| Code: | </head>
<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}" onLoad="show_clock()"> |
the following needs to go into an empty.js file:
| Code: | var myfont_face = "Arial";
var myfont_size = "9";
var myfont_color = "";
var myback_color = "";
var mywidth = 80;
var my12_hour = 1;
var dn = ""; var old = "";
if (document.all||document.getElementById) { document.write('<span id="LiveClockIE" style="width:'+mywidth+'px; background-color:'+myback_color+'"></span>'); }
else if (document.layers) { document.write('<ilayer bgColor="'+myback_color+'" id="ClockPosNS"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); }
else { old = "true"; show_clock(); }
function show_clock() {
//show clock in NS 4
if (document.layers)
document.ClockPosNS.visibility="show"
if (old == "die") { return; }
var Digital = new Date();
var hours = Digital.getHours();
var minutes = Digital.getMinutes();
var seconds = Digital.getSeconds();
if (my12_hour) {
dn = "AM";
if (hours > 12) { dn = "PM"; hours = hours - 12; }
if (hours == 0) { hours = 12; }
} else {
dn = "";
}
if (minutes <= 9) { minutes = "0"+minutes; }
if (seconds <= 9) { seconds = "0"+seconds; }
myclock = '';
myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">';
myclock += hours+':'+minutes+':'+seconds+' '+dn;
myclock += '</font>';
if (old == "true") {
document.write(myclock);
old = "die"; return;
}
if (document.layers) {
clockpos = document.ClockPosNS;
liveclock = clockpos.document.LiveClockNS;
liveclock.document.write(myclock);
liveclock.document.close();
} else if (document.all) {
LiveClockIE.innerHTML = myclock;
} else if (document.getElementById) {
document.getElementById("LiveClockIE").innerHTML = myclock;
}
setTimeout("show_clock()",1000);
} | As you can see I have removed the font and background color to make these two things appear in keeping with varying templates.
and lastly inside the cms_currenttime.tpl file needs to be:
| Code: | <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center">
<tr>
<th colspan="1" width="150" height="25" class="thCornerL" nowrap="nowrap">{CURRENTTIME_TITLE}</th>
</tr>
<tr>
<td class="row2">
<center>
<span class="forumlink">
<script type="text/javascript" src="http://portalogy.myfastforum.org/templates/myfs_portalogy1/myfs_portalogy1.js"></script>
</span>
</center>
</td>
</tr>
</table> | the .js file needs to be a full link in order for the time to appear.
|
admin (no pm's please)
|
hmm, that does raise a few issues for an official implementation which has to avoid being quite that hard for users.
|
blakelives0312
|
or have the script actually in the script tag... and have no file. but it all boils down to how much the user wants it...
or admin can have a small js file on the server and have a link to that. there is no need for each forum to use up they're one js file just for a clock! plus it helps usability ;D
|
admin (no pm's please)
|
Yes as you say a common js file would be the right solution.
|
kingz4dragon
|
So what is going to be done with this component?I like the way it looks but would like to know where the body tag: this is in the overall_header.tpl I would like to add this to one of my forums to see what it looks like on anothe forum.
|
Nick(NR)
|
| kingz4dragon wrote: | | So what is going to be done with this component?I like the way it looks but would like to know where the body tag: this is in the overall_header.tpl I would like to add this to one of my forums to see what it looks like on another forum. |
slowly scroll down your header and find </head> just below it should be the body tag, be sure to look carefully or you'll miss it.
|
|
|