PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
assasyn
New Member
New Member


Joined: Jul 21, 2005
Posts: 2

PostPosted: Wed Jul 20, 2005 11:08 pm Reply with quote Back to top

Hi all,

I have some code that displays the current time and date in various time zones around Australia which I would like to put into my PHP-Nuke site.

This is the code (Taken from MaxxBlade's clock):

<html>

<body>

<table width="43%" border="0">
<tr>
<td width="21%">NSW, QLD, VIC, TAS </td>
<td width="79%"><span id="tP1">tP1</span></td>
</tr>
<tr>
<td>SA, NT </td>
<td><span id="tP2">tP2</span></td>
</tr>
<tr>
<td>WA</td>
<td><span id="tP3">tP3</span></td>
</tr>
</table>

<scri pt type="text/javasc ript">
func tion tN(){
return new Date();
}
fun ction lZ(x){
return (x>9)?x:'0'+x;
}
func tion fY2(x){
x=(x<500)?x+1900:x;
return String(x).substring(2,4);
}

func tion tS(offs){
x=new Date(tN().getUTCFullYear(),tN().getUTCMonth(),tN().getUTCDate(),tN().getUTCHours(),tN().getUTCMinutes(),tN().getUTCSeconds());
x.setTime(x.getTime()+offs);
return x;
}

func tion dS(){
return ((tN().getTime()>fD(0,3,1,1).getTime())&&(tN().getTime()<fD(0,9,1,-1).getTime()))?3600000:0;
}

fun ction fD(d,m,h,p){
var week=(p<0)?7*(p+1):7*(p-1),nm=(p<0)?m+1:m,x=new Date(tN().getUTCFullYear(),nm,1,h,0,0),dOff=0;
if(p<0){
x.setTime(x.getTime()-86400000);
}
if(x.getDay()!=d){
dOff=(x.getDay()<d)?(d-x.getDay()):0-(x.getDay()-d);
if(p<0&&dOff>0){
week-=7;
}
if(p>0&&dOff<0){
week+=7;
}
x.setTime(x.getTime()+((dOff+week)*86400000));
}
return x;
}

fun ction tN(){ return new Date(); }
fun ction dS(){ return ((tN().getTime()>fD(0,9,1,-1).getTime())&&(tN().getTime()<fD(0,2,1,-1).getTime()))?3600000:0; }
fun ction fD(d,m,h,p){ var week=(p<0)?7*(p+1):7*(p-1),nm=(p<0)?m+1:m,x=new Date(tN().getUTCFullYear(),nm,1,h,0,0),dOff=0; if(p<0){ x.setTime(x.getTime()-86400000); } if(x.getDay()!=d){ dOff=(x.getDay()<d)?(d-x.getDay()):0-(x.getDay()-d); if(p<0&&dOff>0){ week-=7; } if(p>0&&dOff<0){ week+=7; } x.setTime(x.getTime()+((dOff+week)*86400000)); } return x; }

fun ction dT(){
// Clock #1
offs=dS()+36000000;
tP1.innerText=eval("dN[tS(offs).getDay()]+' '+tS(offs).getDate()+' '+mN[tS(offs).getMonth()]+' '+fY2(tS(offs).getYear())+' '+'::'+' '+lZ(tS(offs).getHours())+':'+lZ(tS(offs).getMinutes())+':'+lZ(tS(offs).getSeconds())");

// Clock #2
offs=dS()+34200000;
tP2.innerText=eval("dN[tS(offs).getDay()]+' '+tS(offs).getDate()+' '+mN[tS(offs).getMonth()]+' '+fY2(tS(offs).getYear())+' '+'::'+' '+lZ(tS(offs).getHours())+':'+lZ(tS(offs).getMinutes())+':'+lZ(tS(offs).getSeconds())");

// Clock #3
offs=28800000;
tP3.innerText=eval("dN[tS(offs).getDay()]+' '+tS(offs).getDate()+' '+mN[tS(offs).getMonth()]+' '+fY2(tS(offs).getYear())+' '+'::'+' '+lZ(tS(offs).getHours())+':'+lZ(tS(offs).getMinutes())+':'+lZ(tS(offs).getSeconds())");


setTimeout('dT()',1000);
}


var dN=new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
var mN=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');

if(!document.all){
window.onload=dT;
}else{
dT();
}
</s cript>
</body>

</html>


Now it all works fine as a stand alone page, but when I try to add it to the nuke site I get an error about the tags not being allowed.

Id there anyway I can convert this code into either a block or a module as I would like to display it on the main page somewhere.

Sorry if this has been asked before but I'm at work and trying not to get busted surfing the net Smile
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Thu Jul 21, 2005 6:46 am Reply with quote Back to top

well adding the java script stuff isnt a great idea.
also you should take out the body and html tags .
You can try to create in block admin an empty block and then via phpmyadmin add the java script stuff in that block by hand.
View user's profile Send private message
assasyn
New Member
New Member


Joined: Jul 21, 2005
Posts: 2

PostPosted: Thu Jul 21, 2005 8:07 pm Reply with quote Back to top

Got it working thanks Smile
View user's profile Send private message
pan
Involved
Involved


Joined: Jul 25, 2006
Posts: 354

PostPosted: Wed Mar 11, 2009 9:08 pm Reply with quote Back to top

Can someone explain this so I can try to do it?
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum