Holiday Cheer on Forums

Seems like Google has made it popular to change the logo of a website for holidays

My question is how many of y’all do the same, and more importantly do your members like it? 

Over on my photography forum I switched out the default logo with a winter themed one for Christmas.  It’s scheduled to last for a couple more days before getting swapped for New Years.  And then I’ve got a couple more scheduled to appear.  But rather than describing them, here are the logos.

Original Logo

paf_logo

Christmas Logo

logo-christmas2008

New Years

logo-new-years-2009

Inauguration Day – Jan 20, 2009
I’ll probably use this one for July 4th as well.

logo-inauguration-2009 

Valentines Day

logo-valentines-day

 

On all of the logos I kept the basic design the same.  I like the font and reflection.  What can I say, I like stuff that’s got the cliché web 2.0 look.

As far as member response, it has been at least publically positive.  A couple chimed in and said they liked the Christmas logo.  We’ll have to wait to see what happens on the 31st.  That’s when the logo is scheduled to change to the fireworks and it’ll stay that way until the 4th of January.

The code
To have the logo automatically swap I added a function to the index.template.php file in my themes folder and then call that function instead of the tag that normally would display the graphic. It's working for now, but with any luck the forum will get busy enough where the little bit of processing in this function becomes too much.

PHP:
  1. /**
  2. * Returns the path to any special logo like New Years, Christmas, etc.  If not
  3. * within date range it'll return the path to the default logo.   
  4. *
  5. * This returns a complete <img> tag including the height and width so that we
  6. * can still define height and width without having to read the image file every
  7. * time.
  8. */
  9. function logoPath()
  10.     {
  11.     global $settings;
  12.    
  13.     $currentYear = date('Y');
  14.     $currentMonth = date('n');
  15.     $currentDay = date('j');
  16.    
  17.     if ($currentMonth==12 && $currentDay>20 && $currentDay<31)
  18.         {
  19.         //    Christmas logo
  20.         $imgReturn = '<img src="'.$settings['images_url'].'/logos/logo-christmas2008.png" height="85" width="596" alt="Happy Holidays" title="Happy Holidays">';
  21.         }
  22.     else if (($currentMonth==12 && $currentDay==31) || ($currentMonth==1 && $currentDay<4))
  23.         {
  24.         //    New Years
  25.         $imgReturn ='<img src="'.$settings['images_url'].'/logos/logo-new-years-2009.png" height="135" width="595" alt="Happy New Years!" title="Happy New Years!">';
  26.         }
  27.     else if ($currentDay==14 && $currentMonth==2)
  28.         {
  29.         //    Valentines Day
  30.         $imgReturn ='<img src="'.$settings['images_url'].'/logos/logo-valentines-day.png" height="83" width="595" alt="Happy Valentines Day" title="Happy Valentines Day">';
  31.         }
  32.        
  33.     //    Special cases - These can be removed after the date
  34.     else if ($currentMonth==1 && $currentYear==2009 && $currentDay = 20)
  35.         {
  36.         //    Inauguration Day
  37.         $imgReturn = '<img src="'.$settings['images_url'].'/logos/logo-inauguration-2009.png" height="107" width="595" alt="Inauguration Day" title="Inauguration Day">';
  38.         }
  39.    
  40.     //    Default logo
  41.     else
  42.         {
  43.         //    Default logo
  44.         $imgReturn = '<img src="'.$settings['images_url'].'/logo.png" height="70" width="596" alt="Logo" title="Return to forum home page">';
  45.         }
  46.    
  47.     return $imgReturn;
  48.    
  49.     }

Of course you'll need to change the code to point to your logos and work on whatever holidays you want. But using the date() function to get the day, month, and year makes it pretty easy to figure out what should be showing when. My next step will probably be to use the z parameter for date() and use the day of the year (0-365) instead of months and days to make it a little more efficient. Down side is it'll be harder to maintain. 2/14 is a lot easier to remember than day 46.

Question, Comments...

Do you have more questions. Please either leave a comment below or join us in our new forum.

Leave a Reply