Simple Machines Community Forum

General Community => Scripting Help => Topic started by: dbrown on January 17, 2006, 07:35:34 PM

Title: Help Adding Java countdown script to index.template
Post by: dbrown on January 17, 2006, 07:35:34 PM
I'm trying to add a JAVA countdown clock to my index.template file, either underneath the search bar, or next to the time, up in the header. Im using the default theme packaged with RC2. I know the code has to go in index.template.php, but I'm not sure where. While playing around with it, I had no luck getting it to work. Here's what I've tried.

I think my problem lies in how to get the script (in HTML) to work in the PHP environment. Here's what I have:

I've added:
<script type="text/javascript" src="/scripts/countdown.js" defer="defer"></script>
just before the </head> in index.template

The code that the author tells you to add for the clock is:
<h1>New Year 2007 Is Coming!</h1>
    <p>
        Counting down to New Year 2007: <span id="countdown1">2007-1-1 00:00:00 GMT+00:00</span>!
    </p>


I've searched and can't find a way to get this to work how I want.

Any help would really be appreciated!
Title: Re: Help Adding Java countdown script to index.template
Post by: dbrown on January 18, 2006, 03:12:06 PM
Anyone?
Title: Re: Help Adding Java countdown script to index.template
Post by: mastersmurfie on January 18, 2006, 10:52:53 PM
Quote from: dbrown on January 17, 2006, 07:35:34 PM
I'm trying to add a JAVA countdown clock to my index.template file, either underneath the search bar, or next to the time, up in the header. Im using the default theme packaged with RC2. I know the code has to go in index.template.php, but I'm not sure where. While playing around with it, I had no luck getting it to work. Here's what I've tried.

I think my problem lies in how to get the script (in HTML) to work in the PHP environment. Here's what I have:

I've added:
<script type="text/javascript" src="/scripts/countdown.js" defer="defer"></script>
just before the </head> in index.template

The code that the author tells you to add for the clock is:
<h1>New Year 2007 Is Coming!</h1>
    <p>
        Counting down to New Year 2007: <span id="countdown1">2007-1-1 00:00:00 GMT+00:00</span>!
    </p>


I've searched and can't find a way to get this to work how I want.

Any help would really be appreciated!

ok...I was wondering about this as well...in your index.template.php add the <script type="text/javascript" src="/scripts/countdown.js" defer="defer"></script>

exactly where you have it..

then find

// The end of tab section.
echo '
<td class="maintab_' , $last , '">&nbsp;</td>

</table>';


and paste below it:



echo '
<table cellpadding="0" cellspacing="0" border="0" align="right">
New Year 2007 Is Coming!<br>
            Counting down to New Year 2007: <span id="countdown1">2007-1-1 00:00:00 GMT+00:00</span>!

</table>';


the <h1> and <p> will mess up the left side of your forum (more than likely)...take those out, and you should be OK. 

Let me know if this helps...

Title: Re: Help Adding Java countdown script to index.template
Post by: dbrown on January 18, 2006, 11:01:19 PM
That worked great! I bow before your superior intellect!...


DB
Title: Re: Help Adding Java countdown script to index.template
Post by: mastersmurfie on January 18, 2006, 11:09:26 PM
not superior intellect...but about 20 minutes of "trial and error" (mostly error...) ;D

Title: Re: Help Adding Java countdown script to index.template
Post by: Owain on February 21, 2006, 06:56:55 AM
is there anyway to make it countdown from a set event on the calendar and embed it in to a post?

O.