PDA

View Full Version : [RELEASE vB 2.0.3] Countdown To Calendar Events


mister
04 Oct 2001, 06:01
Title: Countdown To Calendar Events hack
Newest Release: 10.04.2001
Author: mister
What It Does: Counts down (to the day) to any public events in the calendar. plus any private events a user may have.
Screenshot: click here for screenshot (http://www.pubarso.com/misc/countdown_screenshot.jpg)
Download: see attached file (countdown1.zip)

Possible Future Enhancements:
span across page, in case of 100's of events
show only private events, only public events, or all
show countdown on actual calendar also



How To Install
1) upload countdown.php to your main forums directory
2) create two templates

countdown_bit

<tr>
<td bgcolor="$altcolor"><a href="calendar.php?s=&action=getinfo&eventid=$event[eventid]"><normalfont>$event[subject]</normalfont></a></td>
<td bgcolor="$altcolor" align="center"><normalfont>$event[eventdate]</normalfont></td>
<td bgcolor="$altcolor"><normalfont>$days_till</normalfont></td>
</tr>


countdown
note: all {} values have spaces in them so this forum doesnt parse them...
copy/paste from the included text file if you dont want to search for all the { blah } variables to change in this template


{ htmldoctype }
<html>
<head><title>$bbtitle - Countdowns</title>
$headinclude
<script language="javascript" type="text/javascript">
<!--
function aimwindow(aimid) {
window.open("member.php?s=$session[sessionhash]&action=aimmessage&aim="+aimid,"_blank","toolbar=no,location=no,menubar=no,scrollbars=no,width=175,height=275,resizeable= yes,status=no")
}
// -->
</script>
</head>
<body>
$header

<table cellpadding="2" cellspacing="0" border="0" width="{ contenttablewidth }" { tableinvisibleextra } align="center">
<tr>
<td width="100%"><img src="{ imagesfolder }/vb_bullet.gif" alt="" border="0" align="absmiddle">
<normalfont><b><a href="index.php?s=$session[sessionhash]">$bbtitle</a> { nav_joiner } Countdowns</b></normalfont></td>
</tr>
</table>

<br>

<table cellpadding=4 cellspacing=1 border=0 bgcolor="{ tablebordercolor }" width="90%">

<tr>
<td bgcolor="{ tableheadbgcolor }"><normalfont><b>Event</b></normalfont></td>
<td bgcolor="{ tableheadbgcolor }" align="center"><normalfont><b>Date</b></normalfont></td>
<td bgcolor="{ tableheadbgcolor }"><normalfont><b>Countdown</b></normalfont></td>
</tr>

$countdown_bits

</table>

$footer
</body>
</html>



3) create a { nav_joiner } replacement variable. (or just edit that out of the template, and put your own in there... its up to you


4) Enjoy.

YourHostSucks
04 Oct 2001, 06:20
Nice, but I had to replace {nav_joiner} with >

Thanks! :)

mister
04 Oct 2001, 06:29
oh yea
ill put that in the instructions.

make a replacement variable { nav_joiner } .. or replace it with whatever..

thanks

YourHostSucks
04 Oct 2001, 06:44
Also.. Is there a reason it does not span the whole page like normal. its only spans about 80-85%?

ex: http://forums.yourhostsucks.com/countdown.php

YourHostSucks
04 Oct 2001, 07:20
One more thing... :)

You will need to edit online.php or it will look like:
Unknown Location: /countdown.php?

----------------------------------------------------------------------
Open online.php:

Around Line 200 you will see alot of "case" statements

Throw this in there somewhere:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Then around line 500 you will see more "case" statements

Throw this in there:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



-------------------------------------------------------------------------------

(FYI)

mister
04 Oct 2001, 13:53
Originally posted by YourHostSucks
Also.. Is there a reason it does not span the whole page like normal. its only spans about 80-85%?

ex: http://forums.yourhostsucks.com/countdown.php

i just it up like that

edit this line:
<table cellpadding=4 cellspacing=1 border=0 bgcolor="{ tablebordercolor }" width="90%">

and change the 90 to something whatever you want.

YourHostSucks
04 Oct 2001, 15:22
Much better :)

Thanks!...
Now I just need the board to be more than a week old, and get some events happening...:p

Mark Hewitt
04 Oct 2001, 15:27
Great hack. What happens if you have like hundreds of events, will it span pages?

mister
04 Oct 2001, 19:10
Originally posted by Mark Hewitt
Great hack. What happens if you have like hundreds of events, will it span pages?

unfortunately, not yet.
maybe ill work this into future releases .. or someone can add that in and give us the code...

i dont need it just yet, so i didnt bother putting it in, but the thought did cross my mind
...

maverick1236
04 Oct 2001, 23:35
this would be great for small boards and user birth-days

could u make it so b-days show up? :)

maverick1236
04 Oct 2001, 23:36
where is this supposed to show up?
i dont see it anywhere lol

TheCaver
04 Oct 2001, 23:51
I like this hack but I would like to add 1-3 of the closest events to the main forum index, maybe a new row above birthdays......this possible?


JC

maverick1236
05 Oct 2001, 00:27
great idea thecaver!!

mister
05 Oct 2001, 07:07
Originally posted by Maverick1236
where is this supposed to show up?
i dont see it anywhere lol


just load countdown.php in your browser.
put a link wherever you see fit (from main page, from header, from calendar, where-ever)

maverick1236
05 Oct 2001, 13:58
what if i want it to actually show below birthdaybits? on forumhome?

Ruth
06 Oct 2001, 13:53
thanks for the hack,

can this be used for the following purpose:

(1) users enter their graduation date in the registration form, for example in the form of [Fixed day - Fixed month - year selected from a drop down menu]

(2) show count down to graduation day in the user profiles.

(3) show the count down by seconds, like most java scripts.

nice hack

thanks :)

Cygnus
06 Oct 2001, 18:07
Originally posted by Ruth
(3) show the count down by seconds, like most java scripts.

Exactly what I was gonna ask... I have a whole mess of freaks (myself included) who simply cannot wait for Thursday at 8:00pm and will want to know how many minutes and seconds they have to wait...

Cygnus

mister
08 Oct 2001, 00:27
thanks for the hack,


You're welcome.


(1) users enter their graduation date in the registration form, for example in the form of [Fixed day - Fixed month - year selected from a drop down menu]

You'd have to do some coding in register.php to have it add that graduation date to the calendar. As of now, the countdown script grabs all dates from the calendar.


(2) show count down to graduation day in the user profiles.

if you got it to add the date to the calendar, i suppose this could be worked out...


(3) show the count down by seconds, like most java scripts.

The countdown script feeds off dates from teh calendar, which doesn't allow for hour/min/second ... so it would just countdown to midnight .. so I just rounded it to the nearest day.


-mister

mister
08 Oct 2001, 00:29
Originally posted by TheCaver
I like this hack but I would like to add 1-3 of the closest events to the main forum index, maybe a new row above birthdays......this possible?


JC

possible? yes
i'll put it in this hack's next release -- which wont be out for quite some time, due to school projects that are piling up :)