EE Insider Tips
Sponsored by EE Screencasts
ExpressionEngine mini-howtos created by the EE Insider community.
Copyright Date
Easy way to make sure your copyright date is always up to date:
© {current_time format="%Y"}
Email
Print
Post to Twitter
Post to Delicious
Bridget — 19:04 on 05.31.2009
Thanks. I just put this into a site I’m building.
Sean Smith — 21:00 on 06.01.2009
If you want your date to have a range and also show only 1 year if the site hasn’t been around for longer than a year then, you should enable php and set to output on the template and then add this code.
<?
$startyear = 2009;
$currentyear = date("Y");
if ($startyear == $currentyear)
{
echo "© $startyear your name\n";
}
else
{
echo "© $startyear - $currentyear your name\n";
}
?>
Andrew Gunstone — 21:32 on 09.08.2009
Hi Sean (and others). Rather then turning on PHP for a template (as it has some security implications), you can use some of the wonderful EE tags to do the same thing…
© Copyright {if {current_time format=”%Y”} != “2009”}2009 - {/if} {current_time format=”%Y”}
Hope that this helps someone!
Cheers
karlosb — 09:00 on 10.06.2009
Hi Andrew,
I have just tried using:
© Copyright {if {current_time format=”%Y”} != “2009”}2009 - {/if} {current_time format=”%Y”}
in one of my EE templates, and I am receiving a PHP Parse error for the that page.
Should this piece of line be placed inside some additional tags?
Thanks in advance
Karl
Add Your Comment?
You must have an EE Insider account to post comments on Insider Tips. It's fast, easy and hassle-free.
Sign up now (or login).