Reference no: EM132153445
You need to practive how to use PHP to implement a dynamic webpage.
Your webpage should display a random joke and a random quote. Furthermore, each time the page is visited, your script should randomly pick up a different joke and a different quote, which should vary based on the current date or the date provided through query string.
If the current date happens to be a national holiday, you should display a joke related to that holiday in red color, and the quote in green color, also relevant to that holiday. The theme of the joke and quote has to be relevant to the holiday.
Choose at least FIVE national holidays. As you know some holidays have dates varing from year to year.
For example, Christmas day is a holiday with fixed date, but easter day is NOT. To simplify your life, let us choose only those holidays with fixed dates.
Which 5? You pick! If the current date is nothing special, you should display a joke randomly and a quote randomly. Certainly you should prepare pools of data to pick.
For now, you can hard code 10 jokes and 10 quotes inside your script, using array data structures for regular days, hard code 2 jokes and 2 quotes for each holiday.
For each joke, you need to provide a link for where you get the joke. For each quote, you need to provide the people to whom the quote should be attributed.
test your program for different dates, you have to either wait until those special days coming or reset server's system date to those different special holiday dates in order to test the result, but usually we cannot wait for each special day to come. So that is not a good way to test your solution.
Therefore you should also page should also be able to extract date information ( year, month, day) provided through query string, so that, user can test your page by manually providing different dates through query string without resetting server's time.
Here are some hints for doing this.
Use randomize to initialize the seed of the pseudo random generator, before you use rnd function, use randomize in a single line.
Use if else and array data structures
In the case of regular days, use 4 arrays of the same size, 1 array for jokes, 1 array for the urls of the jokes, 1 array for quotes, 1 array for the authors of quotes
In the case for special holidays, you can consider to fix data or use a set of separate data structures. the same index, randomly picked, controls the joke, url of the joke, quote, the author of the quote