Get the timestamp of last modification of TYPO3 page, difference between tstamp and SYS_LASTCHANGED

StackOverflow https://stackoverflow.com/questions/15085784

  •  11-03-2022
  •  | 
  •  

Question

What is the right way to get the date of last modification of a TYPO3 page (and its *tt_content*) ?

There are 2 fields in properties of table pages : tstamp and SYS_LASTCHANGED.

In this article SYS_LASTCHANGED are recommended. But what is the role of tstamp in this case ?

Which one should we use ?

Was it helpful?

Solution

tstamp is modification time of the page record itself. SYS_LASTCHANGED is the modification time of the page OR its content. It's updated once the page is rendered in the frontend, not right after the change in the backend. However, thanks to this it also includes changes of content records residing on a different page and inserted into the given page using "Insert Records" content elements.

Note: Tested in TYPO3 4.5 LTS and might not work in later versions.

OTHER TIPS

tstamp is the date and time of the last change of the data stored in the pages table. It gets updated only when the page properties are changed, not the content of the page.

SYS_LASTCHANGED is often called as the real last update of the page including its contents but that seems not to be true at all and is not trustworthy. I can't tell what exactly triggers it's change but it seems to be related to the pages rendering. Even more strange is that it could be 0 on already rendered pages. My advice is to never rely on SYS_LASTCHANGED.

Our way to get the last change of a page displayed is currently as follows:
We added <time date-current="{data.tstamp}"><time> to our custom Contents/Partials/Header/All.html (you need to overwrite the fluid-styled-content-elements) and to our page template. Then a java script does the job to find out the latest change and inserts the html to the page, displaying the last change.

The field SYS_LASTCHANGED is only updated in the frontend once the page has been rendered.

  • Check lastmod in sitemap
  • Edit content element on page
  • Call page in frontend
  • Check sitemap again
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top