简体   繁体   English

如何在Tridion 2011中使用C#检索页面的最新发布日期和当前版本的修改日期?

[英]How to retrieve latest publishing date of a page and modified date for current version using C# in Tridion 2011?

In one of my pages published from SDL Tridion 2011 CMS, there is a requirement to show the latest revision date (ie the date of current modified version of the page) and the last published date of page. 在我从SDL Tridion 2011 CMS发布的页面之一中,要求显示最新的修订日期(即页面的当前修改版本的日期)和页面的最新发布日期。 Can anyone suggest how this can be achieved using SDL Tridion 2011 . 任何人都可以建议使用SDL Tridion 2011如何做到这一点。

Given that your template code is being executed at publish time, to output the latest publish date in a ComponentPresentation or Page, you can just use DateTime.Now 假设您的模板代码是在发布时执行的,则要在ComponentPresentation或Page中输出最新的发布日期,只需使用DateTime.Now

As others have suggested access the Revision Date in the .Info classes. 其他建议访问.Info类中的Revision Date

If you are using DWT or XSLT templates you will either need to make a TBB to place this value in the package, and then output it with your Layout template, or use a custom Function Source to output the value directly. 如果您使用的是DWT或XSLT模板,则需要制作一个TBB将该值放置在包中,然后将其与Layout模板一起输出,或者使用自定义的函数源直接输出该值。

But please specify what kind of templates you are using so we can give a fuller answer 但是请指定您使用的模板类型,以便我们提供更完整的答案

Date/time at which the item was last modified 上次修改项目的日期/时间

There is the RevisionDate property for Page public DateTime RevisionDate { get; } Page public DateTime RevisionDate { get; } public DateTime RevisionDate { get; }

DateTime at which the item was last published 上次发布项目的日期时间

There is the PublishedAt property in the PublishInfo class. PublishInfo类中有PublisherAt属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM