Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: Updating dates with CSS?

  1. #1
    Join Date
    Jul 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Updating dates with CSS?

    Hi

    I am currently making a website using CSS and HTML
    I have made a vertical left-aligned menu, where i wish to put a "last updated: date"
    It is easy enough, but when i have multiple sites, I have to change the date manually on all of the sites.

    Can I somehow enter the date in the stylesheet, so when i change the date in the stylesheet, it changes on all html files?

    Thank you

    from Titties

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No.

    That's not what CSS is for.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, thx

    But is there any other way. For example loading an external file, so i just have to change that file?
    I have tried with an iframe, but it ruins the design.. unless i can make the background see through/0% oppacity?

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    You could use... Frames.. (flinches) The problem with frames is, that if you go to another site that uses frames from your site, the frames in your page will be stuck in the next page. Now, there's a certain way to avoid this, I'm just not sure how...
    - Mike

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The ideal way to do this is via server-side scripting. However, you can also do:
    Code:
    <script type="text/javascript">
      document.write("Document last modified: " + document.lastModified);
    </script>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    But you still have to add it to every page.
    - Mike

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yes, but it's not necessary to update each page.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Right.. I knew that.. lol
    - Mike

  9. #9
    Join Date
    Jul 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you guys

    I solved it myself with the use of an iFrame including and external file I called date.html, so now i just have to change the date.html.. but if you say one might encounter errors with frames, i will certainly try to use somethings else..

    but i am not sure that I understand the code Twey so kindly provided:

    Code:
    <script type="text/javascript">
      document.write("Document last modified: " + document.lastModified);
    </script>
    So i just implement this on all the html sites the same place, like this (for example):
    Code:
    <script type="text/javascript">
      document.write("Document last modified: 1st of september 2008 " + document.lastModified);
    </script>
    And then just change it on one of the html files and then it auto updates on the other HTMLs?

    Did I get that right?

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No

    You'd put the code in verbatim, and it would automatically display the last-modified time of each page. No need to worry about updating it.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •