tips icon image

EE Insider Tips
Sponsored by EE Screencasts

ExpressionEngine mini-howtos created by the EE Insider community.

Copyright Date

User's avatar
  • Posted by Jonathan Longnecker
  • May 29, 2009
  • 12 people have found this tip helpful.

Easy way to make sure your copyright date is always up to date:

&copy{current_time format="%Y"
Bridget19:04 on 05.31.2009

Thanks. I just put this into a site I’m building.

Sean Smith21: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 "&copy; $startyear your name\n";

    
}
    
else
    
{
    
echo "&copy; $startyear - $currentyear  your name\n";

    
}
    ?> 
Andrew Gunstone21: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

karlosb09: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 grin

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).

Search EE Insider Tips
Sponsored By