scriptygoddess

13 Jan, 2010

Never Update the Copyright Year Again (on a PHP page)

Posted by: Jennifer In: PHP

This is a really silly little trick – but if you have a PHP page that has a © copyright year at the bottom – there is no reason you should be updating that every year (unless it's just something you overlooked initially) :) As you get requests from clients now that we're in a new year to change the copyright year in the footer – do yourself a favor and use this instead so you never have to do it again. :)

<?php echo date("Y"); ?>

5 Responses to "Never Update the Copyright Year Again (on a PHP page)"

1 | Ryan Rampersad

January 13th, 2010 at 2:13 pm

Avatar

Great tip! Sometimes when I work with plain static pages, I use a bit of javascript to change the year dynamically.

2 | tcoburn

January 30th, 2010 at 7:31 pm

Avatar

Yeah I always forget about that.

I saw a page the other day, with a "mailto:" link listed on it, that a major web development company developed for a blind client, my best friend Chad, who has a website for a karaoke show he puts on here locally, he does this for a living, he's a really talented performer.

I keep thinking "gosh, he's gonna get so much spam in his email its not funny". I thought that was a horrible thing to do to a fellow blind person. I told him I'd fix it for him, but he says "well no thanks they know what their doing". well apparently not if they left a mailto link right to an email address for a spammer to harvest right on the front page of his website.

He's been a friend of mine since the 4th grade. I feel so bad for him, but maybe I'm making too much out of this, I don't know. Least they could have covered it with Javascript or something.

There is a major learning curve in using speech software for the blind, to read email and webpages to us, there's like a ton of different hotkeys to memorize, and he's going to get frustrated if over half his email is going to be spam.

3 | Rob

February 1st, 2010 at 2:09 pm

Avatar

Hey Jennifer, thanks for the great tip. Just put this one up in my Delicious library.

4 | Sara

February 2nd, 2010 at 7:01 pm

Avatar

Thanks for the reminder, I need to put that in my footers. :)

5 | HighToro

February 3rd, 2010 at 1:27 pm

Avatar

This maybe works better:


/**
* Arma leyenda de copyright del tipo © 2009 Toro Corp. o © 2009-2010 Toro Corp. tomando como a#o de inicio el indicado como parametro y el a#o actual como final.
* @param unknown_type $anno_desde
* @return unknown_type
*/
function copyright_vigente($anno_desde = 2009) {
$anno_actual = date('Y');
$devolucion_annos = "© $anno_actual";
if ($anno_actual > $anno_desde) {
$devolucion_annos = "© $anno_desde-$anno_actual";
}
return $devolucion_annos;
}

Example:


$copy_tt = copyright_vigente(2009);
echo $copy_tt;

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements