Chimpie Well-known member Jul 24, 2011 #1 I'll freely admit I have no idea how to code this, so feel free to laugh at me before responding. I want text "ABC" to show before a certain date, and text "DEF" to show up after that date. Thanks!
I'll freely admit I have no idea how to code this, so feel free to laugh at me before responding. I want text "ABC" to show before a certain date, and text "DEF" to show up after that date. Thanks!
Paul B XenForo moderator Staff member Jul 24, 2011 #2 How is the date being generated? You may be able to do it with basic HTML/CSS by using spans.
Jake Bunce Well-known member Jul 24, 2011 #3 raw php: Code: <?php if (time() < strtotime('2011-07-24 00:00:00')) { echo 'ABC'; } else { echo 'DEF'; } ?>
raw php: Code: <?php if (time() < strtotime('2011-07-24 00:00:00')) { echo 'ABC'; } else { echo 'DEF'; } ?>
Chimpie Well-known member Jul 24, 2011 #5 So is this correct, or should I use 'elseif' for the two middle 'if's? Code: <?php if (time() < strtotime('2011-07-24 00:00:00')) { echo 'ABC'; } if (time() > strtotime('2011-07-24 00:00:01')) if (time() < strtotime('2011-07-26 00:00:00')) { echo 'Between'; } else { echo 'DEF'; } ?>
So is this correct, or should I use 'elseif' for the two middle 'if's? Code: <?php if (time() < strtotime('2011-07-24 00:00:00')) { echo 'ABC'; } if (time() > strtotime('2011-07-24 00:00:01')) if (time() < strtotime('2011-07-26 00:00:00')) { echo 'Between'; } else { echo 'DEF'; } ?>
Jake Bunce Well-known member Jul 24, 2011 #6 Code: <?php if (time() < strtotime('2011-07-24 00:00:00')) { echo 'ABC'; } else if (time() < strtotime('2011-07-26 00:00:00')) { echo 'BETWEEN'; } else { echo 'DEF'; } ?>
Code: <?php if (time() < strtotime('2011-07-24 00:00:00')) { echo 'ABC'; } else if (time() < strtotime('2011-07-26 00:00:00')) { echo 'BETWEEN'; } else { echo 'DEF'; } ?>
Chimpie Well-known member Jul 24, 2011 #8 James said: You could use a switch instead of all the ifs. Click to expand... Yeaaahh, I don't know what that is.
James said: You could use a switch instead of all the ifs. Click to expand... Yeaaahh, I don't know what that is.