Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Background Color Changing Script...
Old 12-21-2009, 02:41 PM Background Color Changing Script...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
I FIXED IT, It was because the quotes were not right...I hate those syntax errors! I should never 'assume something is right because it looks right'...

That's how I made an *** out of myself.

PHP Code:

$background_color 
"#506987"// default GREY background
switch(date("md")) {
     
     case 
0101:
       
// New Years Day background color (light green) on 01/01
       
$background_color "#D5FFD5";
     break;

     case 
0202:
       
// Ground Hog Day background color (dark green) on 02/02
       
$background_color "#178E02";
     break;

     case 
0214:
       
// Valentines Day background color (Pink'ish Purple) on 02/14
       
$background_color "#FE5DCB";
     break;

     case 
0422:
       
// Earth Day background color (Earth Blue) on 04/22
       
$background_color "#2C7DF8";
     break;

     case 
0704:
       
// July 4th - Independence Day background color (Yellow) on 07/04
       
$background_color "#FFF20A";
     break;

     case 
1111:
       
// Veterans Day background color (white) on 11/11
       
$background_color "#FFFFFF";
     break;

     case 
1031:
       
// automatic halloween background color (light orange) on 10/31
       
$background_color "#FFE6CC";
     break;

     case 
1225:
       
// xmas day background color (light green) on 12/25
       
$background_color "#D5FFD5";
     break;

Thanks again!
__________________
Made2Own

Please login or register to view this content. Registration is FREE

Last edited by Brian07002; 12-21-2009 at 02:46 PM..
Brian07002 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-21-2009, 03:14 PM Re: Background Color Changing Script...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
Based on this same exact script, is it possible to change an image instead of a color? Just curious...I am going to look it up, but a quick response would be nice.

After a little more work, that is now accomplished here is the code for anyone if they find it of interest:

PHP Code:

<?php

/////////////////////////////////////////////// Background Color Changer Code //////////////////////////////////////////////



$holiday_image "<img src=\"images/newyear.png\">"// replace image to what you want displayed
switch(date("md")) { 
      
     case 
0101
       
// replace image to what you want displayed on 01/01 of every year
       
$holiday_image "<img src=\"images/newyear.png\">"
     break; 

      case 
0202
       
// replace image to what you want displayed on 02/02 of every year
       
$holiday_image "<img src=\"images/newyear.png\">"
     break; 

     case 
0214
       
// replace image to what you want displayed on 02/14 of every year
       
$holiday_image "<img src=\"images/newyear.png\">"
     break; 

     case 
0422
       
// replace image to what you want displayed on 04/22 of every year
       
$holiday_image "<img src=\"images/newyear.png\">"
     break; 

     case 
0704
       
// replace image to what you want displayed on 07/04 of every year
       
$holiday_image "<img src=\"images/newyear.png\">"
     break; 

     case 
1111
       
// replace image to what you want displayed on 11/11 of every year
       
$holiday_image "<img src=\"images/newyear.png\">"
     break; 

     case 
1031
       
// replace image to what you want displayed on 10/31 of every year
       
$holiday_image "<img src=\"images/newyear.png\">"
     break; 

     case 
1225
       
// replace image to what you want displayed on 12/25 of every year
       
$holiday_image "<img src=\"images/newyear.png\">"
     break; 


/////////////////////////////////////////////// Background Color Changer Code //////////////////////////////////////////////

?>

<?php echo($holiday_image);?>
Thanks!
__________________
Made2Own

Please login or register to view this content. Registration is FREE

Last edited by Brian07002; 12-21-2009 at 03:52 PM..
Brian07002 is offline
Reply With Quote
View Public Profile
 
Old 12-21-2009, 03:16 PM Re: Background Color Changing Script...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
is it possible to change an image instead of a color?
Yes, indeed it is.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-21-2009, 06:51 PM Re: Background Color Changing Script...
Junior Talker

Posts: 1
Name: tom khattab
Trades: 0
Could you help with code to post images rather then color?
<link drop removed>

Last edited by chrishirst; 12-21-2009 at 06:56 PM..
tkhattab999 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Background Color Changing Script...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31217 seconds with 12 queries