Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am trying to display a list of nodes with a "displayOnFrontpageUntil" date parameter. Onle nodes with the date set to after current date should be listed.
How do i go about this?
This might not be the perfect solution, but it will certainly work:
<xsl:for-each select="$currentPage/node"> <xsl:if test="substring(string(Exslt.ExsltDatesAndTimes:difference(umbraco.library:CurrentDate(),node/data [@alias='displayOnFrontpageUntil'])),1,1) != '-'"> <xsl:value-of select="node/data [@alias='bodyText']"/> </xsl:if></xsl:for-each>
Obviously you will need to change the for-each loop to select the appropriate nodes and then change whatever you wish to output in the middle :)
There's also the old
<if test="umbraco.library:DateGreaterThanOrEqualToday( ./data [@alias='theDate'] )">
Great, that works.
ups - press the wrong solved button by mistake. Should have been Chris' post.
Dan Draynes solution makes an error:
System.FormatException: The string was not recognized as a valid DateTime. There is a unknown word starting at index 0
Oops! I've given chris a + to redress the balance.
Well, seeing as we're going down the wrong road already, both solutions should work fine. The umbraco.library command will only work on a valid datetime - are you using the umbraco datepicker to select your date?
yes - the "date picker" data type.
Ooh, did you copy and paste my code direct? using
<if test="umbraco.library:DateGreaterThanOrEqualToday( ./data [@alias='displayOnFrontpageUntil'] )">
Not sure what did wrong before - but have now got it to work with your solution as well.
Thanks for the help.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted