From the course: PHP for Web Designers
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Displaying an up-to-date copyright notice - PHP Tutorial
From the course: PHP for Web Designers
Displaying an up-to-date copyright notice
Let's try something a bit more ambitious and practical with our knowledge of the date function and PHP decision making structures. We're going to create a copyright notice for the Hansel and Petal site that will automatically display the correct date range based on a start year and the current date. If we scroll down in the home page here, there's the copyright notice down in the footer. That's inside a server side include that was created earlier in the course. So we need to go to that server side include and start working. So here it is, footer.php and if we scroll down, there is the copyright notice. It's hard coded, copyright 2013 Hansel and Petal. And with the help of the date function and a bit of PHP logic, we'll be able to update this automatically at the stroke of midnight on New Year's eve. Now, as you should know by now, the web server's time zone needs to be set before you can use the date function. If you set it in a configuration file or if it's been set for you by your…
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
-
-
-
-
-
How PHP makes decisions3m 30s
-
Changing output depending on the current time9m 1s
-
Adjusting the server's time zone8m 57s
-
Displaying an up-to-date copyright notice6m 18s
-
Challenge: Displaying an image of the month2m 15s
-
Solution: Displaying an image of the month5m 12s
-
Understanding what PHP treats as true and false2m 57s
-
-
-
-
-
-