Change content by date...
Hi.
I'm looking for a script that will change content depending on the time of the year. For example. I want to display "Book Now and Save £300" (Before 12th July 2007. Then it will change to "Book Now and Save £200" (Before 12th September 2007 and so on.
I have worked with scripts before that displays a diffurant line by time. But I cant seem to get it to work with a date.
Does anyone know of a script that can do this?
greg posted this at 15:00 — 19th October 2007.
He has: 1,581 posts
Joined: Nov 2005
You could use the built in PHP date function, used with an IF
IF date()=somedate do something
ELSEIF date()=somethingelse do something else
ELSEIF date()=yetanother thing etc etc
do something can be echo your price for that year, get a specific price from the db, or if the prices rarely change perhaps make a variable = your price
Another option is to use a PHP switch, and each case will be each price for the part of year
Even if I could find a full script somewhere for you for this exact thing (which I couldn't from a quick search), you would need to understand a little about PHP to implement it into your own site.
php.net is a good place to search for SWITCH and DATE() if you need to learn just those
dhotchin posted this at 15:19 — 19th October 2007.
He has: 183 posts
Joined: Nov 2003
Thanks
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.