McChicken Posted November 8, 2008 Share Posted November 8, 2008 Hey. I just installed a script that change my site logo on holidays, called "HLogoZ" My problem is that i want the script to show a logo from 1.Dec - 22.Dec and another logo from 23.Dec - 24.Dec. What change do I need to make here: ? } } // Christmas Eve else if ($today == "December 24, $year"){ if (file_exists("$logo_path/$logo_xmaseve")) { echo "<img src='$logo_url/$logo_xmaseve' alt='$logoalt' />"; } else { echo "$imagedefault"; } } // Christmas else if ($today == "December 25, $year"){ if (file_exists("$logo_path/$logo_xmas")) { echo "<img src='$logo_url/$logo_xmas' alt='$logoalt' />"; } else { echo "$imagedefault"; } } Link to comment https://forums.phpfreaks.com/topic/131896-help-with-dates/ Share on other sites More sharing options...
BoltZ Posted November 8, 2008 Share Posted November 8, 2008 Are you declaring today's date in a variable? Link to comment https://forums.phpfreaks.com/topic/131896-help-with-dates/#findComment-685412 Share on other sites More sharing options...
php-pendejo Posted November 8, 2008 Share Posted November 8, 2008 untested but try that first } } // Christmas Eve else if ($today >= "December 1, $year") and ($today <= "December 22, $year"){ if (file_exists("$logo_path/$logo_xmaseve")) { echo "<img src='$logo_url/$logo_xmaseve' alt='$logoalt' />"; } else { echo "$imagedefault"; } } // Christmas else if ($today >= "December 23, $year") and ($today <= "December 24, $year"){ if (file_exists("$logo_path/$logo_xmas")) { echo "<img src='$logo_url/$logo_xmas' alt='$logoalt' />"; } else { echo "$imagedefault"; } } Link to comment https://forums.phpfreaks.com/topic/131896-help-with-dates/#findComment-685419 Share on other sites More sharing options...
corbin Posted November 8, 2008 Share Posted November 8, 2008 You can't compare strings like that. You can compare ordinal values of single characters, but not strings. Link to comment https://forums.phpfreaks.com/topic/131896-help-with-dates/#findComment-685499 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.