Previous Thread
Next Thread
Print Thread
Hop To
#254005 11/08/2013 12:26 AM
Joined: Oct 2006
Posts: 358
enthusiast
enthusiast
Joined: Oct 2006
Posts: 358
I haven't added an Island in about a year.... I think that it would be nice to add one for the Holidays.

Does anyone have one that they've built recently (that they'd share with us)?

Or, does anyone have an "idea" for a good one?


--BIll B
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
I'm actually working to do one for one of my sites; we have a "seasonal ticker" that introduces users to a countdown of the next season, and as a part of that I'm working to introduce a holiday announcement; the issue though is that not all holidays are on a specific day of the year so the ticker has to be updated yearly, but this is what I have so far:

Code
/* PHP CODE HERE */
if((date("m") == 01) && (date("d") == 01)) {
	$holiday_blurb = "Happy New Year!";
	$holiday_name = "New Years Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 02) && (date("d") == 02)) {
	$holiday_blurb = "";
	$holiday_name = "Groundhog Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 02) && (date("d") == 14)) {
	$holiday_blurb = "";
	$holiday_name = "Valentine's Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 04) && (date("d") == 22)) {
	$holiday_blurb = "";
	$holiday_name = "Earth Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 04) && (date("d") == 25)) {
// Changes Every Year, Last Friday in April
	$holiday_blurb = "";
	$holiday_name = "Arbor Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 05) && (date("d") == 11)) {
// Changes Every Year, Second Sunday in May
	$holiday_blurb = "";
	$holiday_name = "Arbor Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 05) && (date("d") == 26)) {
// Changes Every Year, Last Monday in May
	$holiday_blurb = "";
	$holiday_name = "Memorial Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 06) && (date("d") == 14)) {
	$holiday_blurb = "";
	$holiday_name = "Flag Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 06) && (date("d") == 15)) {
// Changes Every Year, Third Sunday of June
	$holiday_blurb = "";
	$holiday_name = "Fathers Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 07) && (date("d") == 04)) {
	$holiday_blurb = "Happy 4th of July!";
	$holiday_name = "Independance Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 09) && (date("d") == 11)) {
	$holiday_blurb = "";
	$holiday_name = "Patriot Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 10) && (date("d") == 31)) {
	$holiday_blurb = "Happy Halloween!";
	$holiday_name = "Halloween";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 11) && (date("d") == 11)) {
	$holiday_blurb = "";
	$holiday_name = "Veterans Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 11) && (date("d") == 28)) {
// Changes Every Year, Fourth Thursday in November
	$holiday_blurb = "Happy Thanksgiving!";
	$holiday_name = "Thanksgiving";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 12) && (date("d") == 24)) {
	$holiday_blurb = "Merry Christmas!";
	$holiday_name = "Christmas Eve";
	$holiday_image = "";
	$holiday_url = "";
} elseif((date("m") == 12) && (date("d") == 25)) {
	$holiday_blurb = "Merry Christmas!";
	$holiday_name = "Christmas Day";
	$holiday_image = "";
	$holiday_url = "";
} elseif(date("m") == 12) {
	$holiday_blurb = "Happy Holiday's!";
	$holiday_name = "Holiday Season";
	$holiday_image = "";
	$holiday_url = "";
} else {
	$holiday_blurb = "None";
	$holiday_name = "None";
	$holiday_image = "";
	$holiday_url = "";
}

if($holiday_name != "") {
	$holiday = "\n\n<br /><br />\n\n<div align=\"center\">\n";

	if($holiday_image != "") { $holiday .= "\t<img src=\"". $holiday_image ."\" alt=\"". $holiday_blurb ."\" title=\"". $holiday_blurb ."\" />\n<br /><br />\n\n"; }
	if($holiday_url != "") { $holiday .= "\t<strong><a href=\"". $holiday_url ."\" target=\"_blank\">". $holiday_name ."</a></strong><hr />\n"; }
	if($holiday_url == "") { $holiday .= "\t<strong>". $holiday_name ."</strong><hr />\n"; }

	$holiday .= "\t". $holiday_blurb;
	$holiday .= "\n</div>\n\n";
} else { $holiday = ""; }

/* BODY HERE */
$body = <<<EOF
$holiday
EOF;

I've been working on this during the week but never really tested it in the UBB, what I put above is just what I've got working using a standalone script but put the ubb formatting for a custom island in place for you; your mileage may vary.

Basically the if statements have a date (with leading zero's), if it's that date then it uses the data supplied; URL is used if you want it to be linked to a URL (used as a description of the holiday), if it's not displayed then it'll be ignored by the "pull together" code at the bottom. The else statement holds the "no holiday" indication.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Oct 2006
Posts: 358
enthusiast
enthusiast
Joined: Oct 2006
Posts: 358
Oh, yes... This is a great idea... A couple of weeks ago I was thinking about adding a "count down" to the forum -- but then I forgot about it. Good reminder.

You can see one of mine at: http://portlandswapmeet.com/


--BIll B
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
The funny part is, I'm in Portland...


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
My "Season Countdown" is:
Code
/* PHP CODE HERE */
if(date("U") <= mktime(0, 0, 0, 3, 20, 2013) /* hour, minute, second, month, day, year */) {
// Spring
$blurb = "until Summer begins";
$color = "FF0000";
$date = "June 21, 2013";
} elseif(date("U") <= mktime(0, 0, 0, 6, 21, 2013) /* hour, minute, second, month, day, year */) {
// Summer
$blurb = "until Summer begins";
$color = "FF0000";
$date = "June 21, 2013";
} elseif(date("U") <= mktime(0, 0, 0, 9, 22, 2013) /* hour, minute, second, month, day, year */) {
// Autumn
$blurb = "until Autumn begins";
$color = "F9930A";
$date = "September 22, 2013";
} elseif(date("U") <= mktime(0, 0, 0, 12, 21, 2013) /* hour, minute, second, month, day, year */) {
// Winter
$blurb = "until Winter begins";
$color = "81A4BA";
$date = "December 21, 2013";
} else {
$blurb = "";
$color = "";
$date = "";
}

/* BODY HERE */
$body = <<<EOF
<script language="JavaScript" type="text/javascript">
today = new Date();
BigDay = new Date("$date");
msPerDay = 24 * 60 * 60 * 1000;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
document.write("<span style=\"color: #$color; font-family:'Comic Sans MS';\">Only " + daysLeft + " days " + hrsLeft +" hours and " + minsLeft + " minutes $blurb!</span>");
</script>
EOF;

Each season has a color and a blurb about it, the MKTime/Date will need to be changed each year; output shows as:
Quote
Only 43 days 3 hours and 4 minutes until Winter begins!

I thought about looking for a javascript ticker to visually count down, but on each page load works fine for my needs for now.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
For you guys you'd probably go with:
Code
/* PHP CODE HERE */
if(date("U") <= mktime(0, 0, 0, 4, 4, 2014) /* hour, minute, second, month, day, year */) {
// Spring
$blurb = "until our next Swap Meet";
$color = "FF0000";
$date = "April 04, 2014";
} else {
$blurb = "";
$color = "";
$date = "";
}

/* BODY HERE */
$body = <<<EOF
<script language="JavaScript" type="text/javascript">
today = new Date();
BigDay = new Date("$date");
msPerDay = 24 * 60 * 60 * 1000;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
document.write("<span style=\"color: #$color; font-family:'Comic Sans MS';\">Only " + daysLeft + " days " + hrsLeft +" hours and " + minsLeft + " minutes $blurb!</span>");
</script>
EOF;


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Oct 2006
Posts: 358
enthusiast
enthusiast
Joined: Oct 2006
Posts: 358
I just remembered WHY I was thinking about this -- our Forum's Birthday is Nov 21th... we will be 12 years old.

I installed this code with only minor tweaks and it worked PERFECTLY the very first time!!! Gizmo, you are DA MAN!!!!


--BIll B
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
Lol, you're welcome tongue


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Oct 2006
Posts: 358
enthusiast
enthusiast
Joined: Oct 2006
Posts: 358
Now, one day later, I'm still PUMPED about this... I've wanted a way to have a custom messages/graphics to pop up on certain dates. (I'd also like to have my HEADER changed on specific dates, ie real Holidays - but that's a different issue).

So -- my question is, if I go crazy with the Custom Island and expand it to list 365 days, do you think that it would work? And is there a way to make sure that each date would be cached so that there's no performance hit for every user that logs in??

Or... maybe there should be a separate PHP file that is called by the Custom Island.... Thoughts???


--BIll B
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
Well, unless it's pulling data from the db you shouldn't really have to worry about too much of a performance hit...


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Oct 2006
Posts: 358
enthusiast
enthusiast
Joined: Oct 2006
Posts: 358
Okay, thanks... i reset the "cache time" for the Custom Island to 240. That should keep it from being accessed except once every 4 hours - frequent enough to allow me to include an image and link for each day of the year.

Cool.


--BIll B

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
spam issues
by ECNet - 03/19/2024 11:45 PM
Looking for a forum
by azr - 03/15/2024 11:26 PM
Editing Links in Post
by Outdoorking - 03/15/2024 9:31 AM
Question on barkrowler and the like
by Mors - 02/29/2024 6:51 PM
Member Permissions Help
by domspeak - 02/27/2024 6:31 PM
Who's Online Now
1 members (Havenofsobriety), 522 guests, and 99 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)