EE Insider Tips
Sponsored by Mijingo's EE 2 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"}
Bridget — 14:04 on 05.31.2009
Thanks. I just put this into a site I’m building.
Sean Smith — 16: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 — 16: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 — 04:00 on 10.06.2009
Hi Andrew,
I have just tried using:
Brian — 09:16 on 06.09.2010
Karl,
The problem with your code is that your quotation marks are curly quotes. They need to be straight quotes.
I use this format too, except I substitute > for != as the operator.
Brian