Page Last Updated Feature

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
5/28/2008 1:13:35 AM
Gravatar
Total Posts 68

Page Last Updated Feature

Hi Joe,

Is there a way that I can get some text at the bottom of every page to show when it was last updated?

Such as "This page was last updated on Wednesday, 28th May, 2008"

Also could it contain the name of the person who updated the page as well?

Such as "This page was last updated on Wednesday, 28th May, 2008 by John Doe"

Does this feature already exist or do you have to create it?

Let me know. Thanks a lot. Nice skin for the portal by the way.

5/28/2008 11:11:52 AM
Gravatar
Total Posts 18439

Re: Page Last Updated Feature

Hi,

We do keep a last modified timestamp on the Pages. Currently its only used in the SiteMap.ashx page which is used to submit your site map to google. It allows google to know better when a page has been updated and needs to be re-indexed.

We currently don't have a feature for this, but it would be easy to create a .NET control that could be added to the layout.master page of a skin and show the last modified time of each content system page. However showing who last modified is a bit more complicated because no edits occur directly on a page but on content instances which happen to be on pages but which could be on more than one page. So it might be better to implement something at the content instance level to show last modified information for each instance of content rather than doing it at the page level. If the page only has one content instance on it then this would appear much the same as if it were at the page level.

I will keep this in mind but I can't commit to any specific timeline for this unless someone wants to sponsor it and make it a priority.

Best,

Joe

6/16/2008 12:48:41 AM
Gravatar
Total Posts 11

Re: Page Last Updated Feature

If you want to include it, use something like:

<script runat="server">
  private void Page_Load(object sender, System.EventArgs e)
  {
[...]

    mojoSiteMapNode mojoNode = (mojoSiteMapNode)SiteMap.CurrentNode;
    LastModified.Text = mojoNode.LastModifiedUtc.ToString();

[...]

 }
</script>

And in your html:
<asp:Label id="LastModified" runat="Server"></asp:Label>

This however will not work on the first node (The http://site/Default.aspx) but on http://site/Default.aspx?pageid=0. Can anyone with more insight in mojoPortal give a reason to why? And if it's possible to solve this isssue? (I.e if SiteMap.currentNode doesn't exist, assume we are on "home" etc.).

Would be great!

6/16/2008 6:05:24 AM
Gravatar
Total Posts 18439

Re: Page Last Updated Feature

You don't need to use SiteMap nodes for this. If you page inherits from mojoBasePage, you can do this:

if(CurrentPage != null)
{
lastModified.Text = CurrentPage.LastModifiedUtc.ToString();
}

If you're not using mojoBasePage, you can get current page with:

using mojoPortal.Business.WebHelpers;

PageSettings currentPage = CacheHelper.GetCurrentPage();

Hope it helps,

Joe

10/2/2008 5:17:42 AM
Gravatar
Total Posts 15

Re: Page Last Updated Feature

Hi

I am trying to do this in a web control that I am adding to the layout.master but it doesn't work

Code:

using mojoPortal.Business;
using mojoPortal.Business.WebHelpers;
public partial class Controls_Footer : System.Web.UI.UserControl
{
  protected void Page_Load(object sender, EventArgs e)
  {
    PageSettings currentPage = CacheHelper.GetCurrentPage();
    if (currentPage != null)
    {
      modLbl.Text = currentPage.LastModifiedUtc.ToString();
    }
  }
}

The error is:
"'mojoPortal.Business.PageSettings' does not contain a definition for 'LastModifiedUtc'"

I am using version: 2239

Any help with the would be great

10/4/2008 8:47:30 AM
Gravatar
Total Posts 18439

Re: Page Last Updated Feature

Hi Tracey,

I started implementing a control for this a while back, and finished it today, it should be in svn trunk by late tonight.

You can add it to layout.master like this:

<span style="color:White;font-weight:bold;"><portal:PageLastModified ID="pageLastMod" runat="server" Visible="false" /></span>

of course you can style it as you wish, the above example is for styleshout-brightsideoflife skin

If you have the current svn trunk, the control actually exists already there but you need to add it to Web.config <pages><controls> like this:

<add tagPrefix="portal" tagName="PageLastModified" src="~/Controls/PageLastModified.ascx" />

It will only show the date using the one currently in svn trunk, but once you get the new version it will show a label as well and has a few properties you can configure like LabelText and ShowTime.

Also if you use the same id as I did, "pageLastMod", you can set Visible to false and this will hide it on non-content system pages. Content Pages are pages in the menu, they are all handled by Default.aspx.cs and there we look for the control with this id and make it visible if it exists.

Hope it helps,

Joe

10/7/2008 5:16:21 AM
Gravatar
Total Posts 15

Re: Page Last Updated Feature

Thanks Joe

You must sign in to post in the forums. This thread is closed to new posts.