Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Vincent DeCapite 64 posts 83 karma points
    Nov 22, 2010 @ 20:29
    Vincent DeCapite
    0

    Page Update Date

    Hi All,

    Hoping I can get some help with this issue. On the bottom of the page, we have a piece of code that says "Page Last Updated on" and the date. The date is being pulled from the UpdateDate from the current page. The only problem is that we have media associated with each page that is updated outside of it. When the media is updated, how can I get the page updated date to change when new media is shown?

    Here is the code i was talking about so far with the updatepage.xslt

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
     version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:msxml="urn:schemas-microsoft-com:xslt"
     xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib"
     exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib ">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <xsl:value-of select="umbraco.library:FormatDateTime($currentPage/@updateDate, 'M.d.yy')"/>
    </xsl:template>
    </xsl:stylesheet> 
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 22, 2010 @ 20:39
    Jan Skovgaard
    0

    How do you want to update the shown media? In the media section?

    If so...will you then be overwriting the current content of the media item, which is used on a given page?

    Or will you pick the new media from within the rich text editor or how you insert it on your content node?

    /Jan

  • Vincent DeCapite 64 posts 83 karma points
    Nov 22, 2010 @ 20:40
    Vincent DeCapite
    0

    The shown media will be updated in the media section. When this happens, the date that the media is updated in the media section should become the new page update.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 22, 2010 @ 20:45
    Jan Skovgaard
    0

    Have you set a custom "updated" field on the media item? I have just been playing around with it locally...

    And when I create a media item and choose an image and hit save I can see the "Create date". But if I choose another image to overwrite the initial image and hit save, I don't get an updated date and the "create date" stays the same...

    But anyhow you need to create a relation somehow, which I cannot figure out at the moment...will turn back if I come up with something...

    /Jan

  • Vincent DeCapite 64 posts 83 karma points
    Nov 22, 2010 @ 21:42
    Vincent DeCapite
    0

    Awesome.. I will work on this too.. Please let me know if you come up with anything.

  • Vincent DeCapite 64 posts 83 karma points
    Nov 23, 2010 @ 13:29
    Vincent DeCapite
    0

    Let me know if you happened to find anything. I was playing around with it, and for some reason I can't get it to call the media Date that is put on the media item.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 23, 2010 @ 15:12
    Jan Skovgaard
    0

    Well it's also some tricky stuff you want to achieve I think...

    But I think that you might be able to succeed if you do this...from the top of my head and NOT tested anywhere

    1) Extend the image mediatype width a property called "umbracoUpdateDate" and choose either date or date with time for this.

    2) Hook into an event perhaps the MediaType "AfterSave" event (full event reference http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/overview-of-all-events) and be sure to update the date of the property when you change the image

    3) In your XSLT macro you should be able to make a check for this "umbracoUpdateDate" property and see if it's empty or actually contains a date. If it's empty you use the data from your document. If it's not you use the date from the field.

    Have I overlooked something? I think that this should actually work...To make a quick proof of concept you can of course just start by selecting the date manually to see what happens etc.

    Give it a go :-)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft