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 - PHP Tutorial
From the course: PHP for Web Designers
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
How PHP makes decisions3m 30s
-
(Locked)
Changing output depending on the current time9m 1s
-
(Locked)
Adjusting the server's time zone8m 57s
-
(Locked)
Displaying an up-to-date copyright notice6m 18s
-
(Locked)
Challenge: Displaying an image of the month2m 15s
-
(Locked)
Solution: Displaying an image of the month5m 12s
-
(Locked)
Understanding what PHP treats as true and false2m 57s
-
(Locked)
-
-
-
-
-