From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Displaying a seasonal feature

Solution: Displaying a seasonal feature - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Solution: Displaying a seasonal feature

I hope I didn't fry your brain too much with that challenge. The idea was to change the main feature image, this image of white roses, and its associated tagline up here. Beautiful arrangements for any occasion, to match the season. And the solution lies in using a foreach loop and the in array function to identify the current season. Let's see how I did it. Let's go to the code first. And that image is on line 43. The image name begins with 980_white_rose, etcetera. We need to change that so it follows a more predictable path. So, let's open the images folder. And there is the 980 white rose. There are also three images that begin feature_, followed by a season name. There's autumn, spring, and summer. So, this one needs to be winter. Let's change that name. Feature_winter.jpg. Now, there were two arrays that I created in the text file. Let's get them, they're in arrays.txt. Let's open that, copy them, and we need to paste them into index.php. And they need to go in the code block at…

Contents