Copter Labs Copter Labs

Smart Design.

For Smart People.

Hold on... This isn't EnnuiDesign.com — What Gives?

It's been a long time coming, but Jason Lengstorf, formerly of Ennui Design, has expanded his team to include Drew Douglass, Rob MacKay, Henry Moran, and Tom Sturge.

It didn't feel right to keep the same name, so we decided to continue on as Copter Labs. You can expect the same great content under this new name!

Automate Your Copyright Notices

If you've built blogs for clients before, or created a site based on a content management system, then you know keeping copyright information up-to-date can be a pain.

It used to be that every year, I'd have to pull up every single client's site and edit the year, which would eat up a full day of my time. It was a terrible way to start the new year, and after a couple years of tedium, I decided to deal with it once and for all.

View the Demo | Download Source

Automatically Update the Year

My first instinct was to simply use PHP's handy date() and time() functions to automatically find the year. To get the current year, you can use this snippet of code:


This prints the current four-digit year. This technique wasn't enough, however. On websites, you need to keep the original year of the site's creation in order to cover the original content. So we need to have a range (i.e. 2006-2009).

Keep the Original Year Displayed

So we don't lose the original year, it would make sense to simply add the original posted year to the script, like so:

2006-

Now that looks great! However, what happens for new sites? We'll end up with a copyright notice for the first year that reads "All Content Copyright © 2009-2009 Company Name". This obviously isn't what we want.

Combine Both Ideas

To solve this issue, I wrote a quick function to check if the current year matches the creation year of the site, then outputs the copyright date appropriately.

 $created) ? $created.'-'.$current : $current;
}
?>

All Content © Client Name

Hey presto! Now, for every site we create from this point forward, copyrightYear() will output the correct year or year range for your copyright notice, and you don't ever have to worry about it again!

View the Demo | Download Source

Moving Forward

Do you have any time-saving tips? How about time-consuming tasks you wish you could automate? Let me know in the comments!

Date. 02/10/2009

Comments. 16

Category. PHP

Jason Lengstorf

Jason Lengstorf

Jason Lengstorf a turbogeek hailing from Portland, Oregon. He designs and develops websites using PHP, MySQL, JavaScript (jQuery), CSS, and HTML. He's written two books (PHP for Absolute Beginners [2009 Apress] and Pro PHP and jQuery [2010 Apress]), and he's written articles on development and design for Nettuts, CSS Tricks, and Smashing Magazine, among others.

Was This Post Helpful? Pass It On!

Share the Love

If this post taught you something, reminded you of something you had forgotten, or just made you feel good, there's really no better way to say "thank you" than passing it along to your friends.

Don't forget to like us on Facebook, join our newsletter, and/or subscribe to our RSS feed to make sure you hear about new posts first!

Join Our Gaggle of Geeks
* indicates required

Comments.

  1. Gravatar

    Hey, just wanted to say thanks for this. Little thing that will save loads of time. Very cool.

  2. Gravatar

    Nice post! Definately will be using this on future projects

  3. Gravatar

    I'm not a lawyer, but I play one on T.V.

    Wait, that's not right.

    Oh yeah: I'm not a lawyer, but I did take a media law class as part of my college degree and we talked a lot about copyright law.

    You said, "on websites, you need to keep the original year of the site's creation in order to cover the original content." But so far as I learned, that's not true. In fact, you don't even need to slap the copyright symbol on anything you create in order to copyright it.

    Copyright law states that, as soon as you create something, you own the copyright. Build a website? You own the copyright. Snap a photo on your friend's camera? You own the copyright. Draw a little doodle on the back page of your in-flight magazine? You own the copyright. This comment I've written? I own the copyright and give you permission to publish it on your site. -)

    Note that this only applies to things you create. You can't copyright an idea (that's what patents are for).

  4. Gravatar

    @Thomas J. Brown:

    Hmmm...

    I found conflicting information online, so I figured it's better to be safe and post the copyright just in case.

    It's comforting to know that I'm not giving away content if I don't post a copyright notice on it, though.

    Thanks for the heads up!

  5. Gravatar

    No problem.

    And like I said, I'm not a lawyer, and it was just one class, so I could be wrong. Web stuff is... Tricky at best.

    All that said, it's still a really good tutorial and I'll probably make use of it in the future.

  6. Gravatar

  7. Gravatar

    Hi Jason,

    Thanks for the script will try it on my website :)

    Regards,

    Janet Gify

  8. Gravatar

    Get drafted second overall in a given draft and expect expectations to be through the roof.Fortunately, though, when you're drafted that high, the thinking is you can handle and overcome high expectations.Such is the case with Boston Bruins forward Tyler Seguin, a highly skilled 19-year-old who's looking to burst onto the NHL stardom scene in his sophomore season after a Stanley Cup-winning rookie campaign.

  9. Gravatar

    I like the valuable info you provide in your articles. I will bookmark your weblog and check again here regularly. I’m quite sure I’ll learn many new stuff right here! Best of luck for the next!

  10. Gravatar

    Crooked a crooked silver skull head: "You mean, just kill the two guys to be able to eliminate the light of God's anger?"

  11. Gravatar

    Nice to be visiting your blog again Herve Leger, it has been months for me. Well this article that i’ve been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article Herve Leger Dresses. Thanks, great share.

  12. Gravatar

    And consumers are already feeling the impact, especially cooling food prices.

    Mr. Xing, Consumer, said, "Pork is cheaper now. It was 14 yuan per kilogram, and now its 12 yuan."The titleist 910d2

    titleist 910D3

    Ping G20

    Taylormade r11

    Taylormade r11 Driver

    titleist 910d2

    titleist 910D3

    Ping G20

    Taylormade r11

    titleist 910d2

    titleist 910D3

    Ping G20

    Taylormade r11

    titleist 910d2

    titleist 910D3

    Ping G20

    Taylormade r11

    Wilson Tennis Racket

    Babolat Tennis Racket

    Head Tennis Racket

    Prince Tennis Racket

    Wilson Blx

    government has been strengthening measures to control inflation, which rose to uncomfortably-high levels earlier this year.Now efforts seem to have paid off.Shi Laibin, General Manager of Shandong Shouguang Produce Market, said, "Compared with last year, the general price has fallen about 30 percent. Cabbage prices are down 70 percent. And so are radishes, white turnips and carrots. "

  13. Gravatar

    This was a useful post and I think it is rather easy to see from the other comments as well that this post is well written and useful. Thank you very much.

  14. Gravatar

    wonderful post...

  15. Gravatar

    It's cool. How you can do that!

  16. Gravatar

    ceng you de jing guo...

Join In.

Have something to say? By all means, speak up!

But first, a few rules:

  • Don’t be a jerk.
  • Use your real name, not your business name - this is a discussion, not a billboard.
  • Only <strong>, <em>, and <code> are allowed tags.
  • Wrap code samples in <code> tags.

Happy commenting!

Add a Comment