Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Updating the © 2007 at the bottom of a lot of pages...

Options
  • 23-01-2008 7:27pm
    #1
    Closed Accounts Posts: 12,382 ✭✭✭✭


    Hello

    Is there any way to do a mass update of the © 2007 at the bottom of my websites?

    I would be looking for a command line solution.

    From a bit of googling I've come across awk, but that seems really awkward to use...

    Does anyone have a solution to this?

    Thanks :)


Comments

  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    Depends on what you're using for the site.

    PHP

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

    JavaScript

    today=new Date();
    yr=today.getFullYear();
    document.write("©"+yr);

    etc, etc.


  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    Hi Liam

    Thanks for the reply.

    Currently it's "© 2007". Replacing that with <?php echo "© ".date("Y"); ?> would be ideal!

    Although I am happy to just replace 2007 with 2008.

    Is there a way to do this?

    You know, "in /home/* look for © 2007 and replace with © 2008"...


  • Moderators, Education Moderators, Technology & Internet Moderators, Regional South East Moderators Posts: 24,056 Mod ✭✭✭✭Sully


    You should really split the top and bottom of each page into a header and footer, then include them on each page using PHP. It makes life a lot easier - its a pain if its a big site to go changing each page.

    If not, you should just use "Search and Replace" in your editor so it searches for it.

    Not sure about a shell alternative, I don't like editing pages that way!


  • Registered Users Posts: 35,524 ✭✭✭✭Gordon


    For simple stuff like that I use my trusty TextWrangler program and set it off on a simple find/replace or a tasty Grep through specified folders, or on all my open text documents.

    I think it's Mac only though: http://www.barebones.com/products/textwrangler/

    You'd be best doing the header/footer thing in future for this kind of thing as has been mentioned.

    So, yes it's possible but you need the program to do it.


  • Registered Users Posts: 6,511 ✭✭✭daymobrew


    dublindude wrote: »
    From a bit of googling I've come across awk, but that seems really awkward to use...
    sed is probably easier.
    for f in *.html
    do
      echo $f
      mv $f $f.bak
      sed 's/copy; 2007/copy; 2008/' $f.bak >$f
    done
    
    This will make a backup of each file before making the changes. You can diff the files to ensure it worked correctly.


  • Advertisement
  • Registered Users Posts: 3,401 ✭✭✭randombar


    notepad++ allows you to find and replace with all open documents (pretty handy!)


  • Closed Accounts Posts: 270 ✭✭CoNfOuNd


    From the command line:

    replace "2007" "2008" -- /home/user/www/directory/*

    Obviously be careful with this and make sure you aren't replacing other stuff! Use grep first to see a list of all the files with 2007 in them.


  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    Thanks everyone for the replies.

    I've have a play around with your suggestions and see what I come up with.

    Cheers!


  • Moderators, Science, Health & Environment Moderators Posts: 8,956 Mod ✭✭✭✭mewso


    I'm curious about copyrights on a web page. I'm pretty sure it's not necessary to display a copyright (web pages are automatically copyrighted??) anyway but if you choose to do so surely you want to keep the date that the page was created and not update it to the current date?


Advertisement