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

好久不见. 提交于 2021-02-07 12:50:22

问题


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 ?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/15085784/get-the-timestamp-of-last-modification-of-typo3-page-difference-between-tstamp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!