/ Published in: PHP
__A lot of websites are victim of outdated copyright notices, 2008, 2009 even 2000.__
This function is designed to combat this annoyance, resulting in proper copyright notices. With **valid years**, and also valid **Typography**, separating the dates with an **En dash** and using **character entities**.
Using this function in your footer will create an output string similar as:
*****
<code>2008–2011 © </code> for $startYear = 2008
*****
<code>2011 © </code> if the $startYear is equal(or bigger) compared to the current year, note that if an invalid date(higher) is passed as the argument the function will still return the current year
*****
<code>Our company 2011 © </code> for $startYear = "Our company" **(not advised)**
*****
<code>2009–2011 © Our company</code> for $startYear = 2009 and $txt = "Our company" **(advised)**
This function is designed to combat this annoyance, resulting in proper copyright notices. With **valid years**, and also valid **Typography**, separating the dates with an **En dash** and using **character entities**.
Using this function in your footer will create an output string similar as:
*****
<code>2008–2011 © </code> for $startYear = 2008
*****
<code>2011 © </code> if the $startYear is equal(or bigger) compared to the current year, note that if an invalid date(higher) is passed as the argument the function will still return the current year
*****
<code>Our company 2011 © </code> for $startYear = "Our company" **(not advised)**
*****
<code>2009–2011 © Our company</code> for $startYear = 2009 and $txt = "Our company" **(advised)**
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Author: Jeroen Ransijn // Auto updating copyright notice function auto_copyright_notice($startYear,$txt) { // this line will compare the startYear with the current year, if this is the same only display the startYear // if this is false, both show: $startYear 'en dash(Study Typography you nerd!)' $currentYear // note that if $starYear is bigger then the current year, // or isn't an integer this function will still return the current year return $year . " © " . $txt; }