1

In one of my pages published from SDL Tridion 2011 CMS, there is a requirement to show the latest revision date (i.e. the date of current modified version of the page) and the last published date of page. Can anyone suggest how this can be achieved using SDL Tridion 2011 .

1
  • 2
    Which publishing model are you using, and what kind of templates? Jul 9, 2012 at 8:56

2 Answers 2

8

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

As others have suggested access the Revision Date in the .Info classes.

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.

But please specify what kind of templates you are using so we can give a fuller answer

4

Date/time at which the item was last modified

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

DateTime at which the item was last published

There is the PublishedAt property in the PublishInfo class.

4
  • Any idea how to get to the PublishInfo from a Page object? I've been going through the API docs, but haven't found it so far. Failing that, I'd suggest Chris' approach as the best alternative: just use DateTime.Now. Jul 9, 2012 at 12:54
  • You're right. PublishInfo isn't available from the Page. So, the Chris' solution is the best one for this case. Jul 9, 2012 at 13:03
  • 2
    I kept reading and it seems you get it via PublishEngine.GetPublishInfo(IdentifiableObject item). I still think Chris' solution is simpler, but at least the "how to get the PublishInfo.PublishedAt?" question is also clear. Jul 9, 2012 at 13:13
  • 1
    Yes, you can check the example here. Jul 9, 2012 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.