Results 1 to 5 of 5

Thread: Display date modified

  1. #1
    User
    Join Date
    02-01-10.
    Posts
    111

    Default Display date modified

    I would like to display the date when the page was modified in the footer. So far I have not found a pre-built way of doing it. How could I go about implementing something like this?

  2. #2
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Display date modified

    Check out http://www.typolight.org/insert-tags.html for ways to insert all sorts of predefined/dynamic snippets of content.

    In your case, you'd paste "{{last_update}}" anywhere you want to show the last modified date.

    Note -- not 100% sure if that's the page's last modified date, or the site's... Maybe someone can clarify.
    Brian

  3. #3
    User
    Join Date
    02-01-10.
    Posts
    111

    Default Re: Display date modified

    Thank you - this worked! I used {{last_update}} wild card. It showed me the date and the time. I did not want to see the time. I was able to eliminate the time from showing up by modifying the Date and Time format field in settings where I removed "H:i".

  4. #4
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Display date modified

    Two things --

    1. Check out the PHP strtotime() and date() functions. These will help you take an existing date and format it how you want it in a template (you may need one or both depending) -- so you can have different date formats per-template if you need them.

    2. When you create a new TL site, the first page should be a "Website root", with all of your other pages under that (I learned this fairly recently myself). This gives you several advantages that will be obvious once you see the options for that page type. But one is the ability to set the date format there.

    I mention this because I've had issues changing the date and time formats in the global settings. If it's a format TL doesn't like, it can break the site, I believe because of how it uses dates and times in the DB.
    Brian

  5. #5
    User
    Join Date
    02-01-10.
    Posts
    111

    Default Re: Display date modified

    Thanks for these tips! Since I don't know PHP all that well, I was not entirely sure how to use the PHP functions in my page. I did follow your suggestion and set the Date and Time fields in Website root. I had a Webroot page, but I had not specified the Date and Time formats there. Now that I have specified them there, they get reflected on my page. I should note however that just as before the {{last_update}} takes a value from Date and Time format field in the Webroot page. So, to display just the date, I eliminated the time formatting from that field.

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
  •