Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
gareth connop
14,865 PointsDynamic copyright year
Does anybody know the most samantic way to add a dynamic year to your HTML sites copyright statement?
I know I could add php (<?php echo date ("Y"); ?>) in place of the current year but is this the correct way to do this?
Thanks in advance
Gareth
3 Answers
Aaron Martone
3,290 PointsWell, aside from the fact that a copyright doesn't exist each year automatically, but assuming your papers are in line, I've always done the following with ColdFusion:
<cfoutput>Copyright © #year( now() )# Aaron Martone. All Rights Reserved.</cfoutput> Would generate:
Copyright ©2013 Aaron Martone. All Rights Reserved.
You could always encase the year in a <time> tag, but since it provides a span of a whole year, it wouldn't really add any semantic value in doing so.
Jake Craige
4,913 PointsYeah I do it with the php date function the same way on my websites. you could use short tags I guess if you wanted it to be shorter or something
<?= date('Y') ?>
gareth connop
14,865 PointsHi Aaron/Jake,
Thanks for letting me know the ways in which you guys do things. I think I'm just going to add the PHP.
Thanks again.