Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
There's a built-in gadget for that (see this topic). If you'd rather do it through code, I believe you should check ChangeLog.GetChanges.
Thanks for a quick reply Johan. I am very new to this so I think I need more direction. Also I'll clarify - I want to display the list of pages (linked) on the user facing website. So when a user goes to our home page, it shows a list of links to the most recently changed pages. Can you elaborate on how I would go about that?
If you are using ASP.NET MVC you could try something like this. I wrote the code here so it's not tested but I think it should work just fine.
public ActionResult Index(PageData currentPage) { var queryService = ServiceLocator.Current.GetInstance<IPageCriteriaQueryService>(); var changedPages = GetRecentlyChangedPages(queryService, 10); // do something with the result }
public IEnumerable<PageData> GetRecentlyChangedPages(IPageCriteriaQueryService queryService, int daysBack) { var criteriaCollection = new PropertyCriteriaCollection(); var criteria = new PropertyCriteria { Condition = CompareCondition.GreaterThan, Name = "PageChanged", Type = PropertyDataType.Date, Value = DateTime.Now.AddDays(-daysBack).ToString(), Required = true }; criteriaCollection.Add(criteria); return queryService.FindPagesWithCriteria(ContentReference.StartPage, criteriaCollection); }
Cheers
- Marcus
Is there a way to display a list of links to the most recently updated pages (up to 10) on Epi 7.0?