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 an image of the month

Solution: Displaying an image of the month - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Solution: Displaying an image of the month

Here's my solution to the challenge of displaying an image of the month. The first thing to do is to get the name of the existing image of tulips from the HTML at the bottom of index.php, and then change it. There's the image, it's on line 83. It's name begins with 450_2_tulip. That should be sufficient to find it. So let's go to the Images folder and there it is 450_2. Yep that's it. So we need to change that name to special_apr.jpg. And if we now look at our files, our images, we've got 12 images. All of which begin with special underscore, followed by the first 3 letters of the month. So we can now go back to our editing program. And we need to change the image name here. We're going to select that, delete it, and insert special_, because that's the way that each name begins. And then we have a PHP code block. And we're going to echo the months name. We don't yet have a variable for that, but we'll call it months name. And then the closing PHP tag. It's very important to make sure…

Contents