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

Displaying an up-to-date copyright notice - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

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…

Contents