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.
Challenge: Inserting the appropriate alt text - PHP Tutorial
From the course: PHP for Web Designers
Challenge: Inserting the appropriate alt text
In the previous chapter, we used the date function to get the first three letters of the current month's name. The codes there on line two in index.php in the Hansel and Petal site. And we used it to display an image of the month. However, if we go down to where that image is in the HTML. There it is down here. We can see that the alternate text is still hard-coded. And it says fresh tulips. Armed with the knowledge you've gained about arrays, I'd like you to think about how you might go about changing the alternate text so that it matches the image. Now, to help you, if you go to the handp_check folder, Open that and go to 04_03. In there is a text file called alternate.txt. And that contains some suggested alternate text for each month. There are actually quite a few ways you could do this. The challenge isn't to find the most sophisitcated approach. All you need is something that works. Take a look at the online documentation for the date function. Take a look at the formatting…
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)
Storing multiple values in a variable as an array4m 28s
-
(Locked)
Inspecting an array's elements4m 13s
-
(Locked)
Challenge: Inserting the appropriate alt text1m 27s
-
(Locked)
Solution: Inserting the appropriate alt text5m 26s
-
(Locked)
Displaying an array as a comma-separated list3m 13s
-
(Locked)
Looping through an array's values7m 17s
-
(Locked)
Labeling array elements7m 21s
-
(Locked)
Looping through an array's labels and values5m 29s
-
Finding if a value exists in an array3m 51s
-
(Locked)
Challenge: Displaying a seasonal feature3m 6s
-
(Locked)
Solution: Displaying a seasonal feature8m 30s
-
(Locked)
-
-
-
-