• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How to setup a countdown clock

Swansoft

New Member
Joined
Apr 13, 2013
Messages
49
Reaction score
0
Hi guys ive been trying to get a countdown clock for ages now and just recently got one with help from ninja so all reps do go to him..

First your going to want to goto the same folder as your layout.php is in and create a file called countdown.js

Then paste this into your countdown.js


countdown.js
PHP:
function getStartTime(cet_now,cet_to,ticks)
{
	now = new Date(cet_now);
							
	//ENTER BELOW THE DATE YOU WISH TO COUNTDOWN TO
	later = new Date(cet_to);
			
	ticks = ticks + 1
			
	diff = (later - now - ticks*1000)
			
	days = diff / 1000 / 60 / 60 / 24;
	daysRound = Math.floor(days);
					
	hours = diff / 1000 / 60 / 60;
	hoursRound = Math.floor(hours);
					
	hours2 = diff / 1000 / 60 / 60 - (24 * daysRound);
	hoursRound2 = Math.floor(hours2);
				
	minutes = diff / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound2);
	minutesRound = Math.floor(minutes);
			
	seconds = diff / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound2) - (60 * minutesRound);
	secondsRound = Math.round(seconds);
					
	if(hoursRound < 0 || minutesRound < 0 || secondsRound < 0)
	{
        document.getElementById('days').innerHTML = "0";
		document.getElementById('hours').innerHTML = "0";
		document.getElementById('minutes').innerHTML = "0";
		document.getElementById('seconds').innerHTML = "0";
	}
	else
	{
        document.getElementById('days').innerHTML = daysRound;
		document.getElementById('hours').innerHTML = hoursRound2;
		document.getElementById('minutes').innerHTML = minutesRound;
		document.getElementById('seconds').innerHTML = secondsRound;
		newtime = window.setTimeout("getStartTime('"+cet_now+"','"+cet_to+"', "+ticks+");", 1000);
	}
}


Then goto layout.php find this

<script type="text/javascript" src="<?PHP echo $layout_name; ?>/initialize.js"></script>

and paste this underneath.

<script type="text/javascript" src="<?PHP echo $layout_name; ?>/countdown.js"></script>

STILL IN LAYOUT.PHP

Find this

<div id="<?PHP echo $subtopic; ?>" class="Box">

above it paste this

<?PHP echo $news_content; ?>

OK GOTO LATESTNEWS.PHP

under the very first

paste this

PHP:
 $news_content .= '<div id="featuredarticle" class="Box"> 
   <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div> 
   <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div> 
   <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div> 
   <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);"></div> 
   <div class="Border_2"> 
       <div class="Border_3"> 
           <div class="BoxContent" style="background-image: url("'.$layout_name.'/images/content/scroll.gif");"> 
                   <tr>'; 
                
                    $news_content .= '<div class="stats-box"><h1><font size="5"><font face="martell" color="red"><B><center>Qunteot.net starting 25.5.2013 18:00 CEST (GMT + 1:00)  </center></BOLD></font> 
                    <font size="4"><h1>Qunteot.net starts in:</h1></font> 

                <table class="center countdown"> 
                    
                     <tr> 
                        <td><div id="days"></td> 
                        <td><div id="hours"></td> 
                        <td><div id="minutes"></td> 
                        <td><div id="seconds"></td> 
                    </tr> 
                    <tr> 
                        <td>days</td> 
                        <td>hours</td> 
                        <td>minutes</td> 
                        <td>seconds</td> 
                    </tr> 
                </table> 
                 

               <script type="text/javascript">getStartTime("Apr 22 2013 20:15:00", "May 25 2013 19:00:00",0);</script><br/></div>';

REMEMBER TO CHANGE THE BOTTOM OF THE SCRIPT IN LATESTNEWS.PHP SO IT WORKS CORRECTLY..



ALL REPS GOTO NINJA
 
bug.png


my layout.php :-
http://pastebin.com/znCCBP6Q

my latestnews.php:-
http://pastebin.com/CmS1hkGq
 
Back
Top