Auto update your website copyright

Discussion in 'Programming' started by iamntb, Dec 28, 2011.

  1. #1
    Don't forget to update your sites copyright for the new year. One of the easiest ways to do this is include the code Copyright &copy; your start year – <?php echo date(‘Y’); ?>
    and then you will never have to worry about it again.

    Sincerely,
    IamNTB
     
    iamntb, Dec 28, 2011 IP
  2. kokopelli

    kokopelli Peon

    Messages:
    2,436
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Or, via Javascript if you don't use PHP:

    <script language = 'JavaScript'>
    <!--
    function y2k(number) { return (number < 1000) ? number + 1900 : number; }
    var today = new Date();
    var year = y2k(today.getYear());
    document.write('Copyright &copy; '+year+' mysite.com - All Rights Reserved');
    //-->
    </script>
    Code (markup):
     
    kokopelli, Dec 28, 2011 IP
  3. Chronus

    Chronus Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Using JS to do this is a bad practice. It would be better to do it manually with HTML because the JS relies on the local machine.
    Personally, I just use PHP the same way imntb posted it.
     
    Chronus, Dec 29, 2011 IP
  4. GregH

    GregH Greenhorn

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    I would have to agree.

    Although it can be done easily enough with JS.
    It would be neater, easier in the code and quicker to load as PHP.
     
    GregH, Dec 29, 2011 IP