Sean
11-07-2005, 04:50 AM
This is a very simple php script I put together so I wouldn't have to update my copyright statements on all my sites (which I hope to eventually have lots of) each year. I know that it's very simple but, since it does no harm to share it, I figured maybe someone who doesn't know PHP or someone who does and didn't think of it could find it handy.
ITEM Copyright ©
<?php
if (date("Y") == '2005')
{
echo date("Y");
}
else
{
echo '2005-'; echo date("Y");
}
?>
NAME. All Rights Reserved.
If the current year is 2005, it will display:
"ITEM Copyright © 2005 NAME. All Rights Reserved."
If the current year is over 2005, it will display:
"ITEM Copyright © 2005-XXXX NAME. All Rights Reserved."
Where XXXX is the current year.
Just replace "NAME" with your company or site's name and "ITEM" with whatever it is you're stating your copyright for (i.e "site", "layout" or "content") and you shouldn't have to touch it. Also, you can replace the captal Y in the third "date("Y")" with a lower-case "y" to display just the last 2 digits of the current year ("2005-06")... but I prefer the full year.
If you're seeing/using this in 2006+ just replace both 2005's in the PHP with your current year.
Again I know it's really simple but could save some time and effort over the years if you have a lot of sites.
EDIT:
here's a link to the date() function incase anyone has any other ideas for it:
http://php.net/manual/en/function.date.php
ITEM Copyright ©
<?php
if (date("Y") == '2005')
{
echo date("Y");
}
else
{
echo '2005-'; echo date("Y");
}
?>
NAME. All Rights Reserved.
If the current year is 2005, it will display:
"ITEM Copyright © 2005 NAME. All Rights Reserved."
If the current year is over 2005, it will display:
"ITEM Copyright © 2005-XXXX NAME. All Rights Reserved."
Where XXXX is the current year.
Just replace "NAME" with your company or site's name and "ITEM" with whatever it is you're stating your copyright for (i.e "site", "layout" or "content") and you shouldn't have to touch it. Also, you can replace the captal Y in the third "date("Y")" with a lower-case "y" to display just the last 2 digits of the current year ("2005-06")... but I prefer the full year.
If you're seeing/using this in 2006+ just replace both 2005's in the PHP with your current year.
Again I know it's really simple but could save some time and effort over the years if you have a lot of sites.
EDIT:
here's a link to the date() function incase anyone has any other ideas for it:
http://php.net/manual/en/function.date.php