Copied to clipboard

Flag this post as spam?

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


  • Lee 1130 posts 3088 karma points
    Dec 10, 2009 @ 14:11
    Lee
    0

    Selecting Nodes From Todays Date Onwards?

    I am creating an events list, where the user puts in a date of the event - I have been pulling the nodes through fine, but now I would like to display the events to the user from today's date onwards?

    As the results for past events are a bit pointless - Just wondering if anyone has done anything similar?  If so could I ask for a sneak peek at your syntax?

    Any help appreciated =)

  • dandrayne 1138 posts 2262 karma points
    Dec 10, 2009 @ 14:12
  • Nik Wahlberg 639 posts 1237 karma points MVP
    Dec 10, 2009 @ 14:14
    Nik Wahlberg
    0

    Hey Lee,

    something like this should do:

            <xsl:variable name="eventNodes" select="$currentPage/node [
                      @nodeTypeAlias = $documentTypeAlias and
                      string(data [@alias='umbracoNaviHide']) != '1' and
                      (
                        (data [@alias = 'eventStartDate'] != '' and umbraco.library:DateGreaterThanOrEqualToday(data [@alias = 'eventStartDate']))
                        or
                        (data [@alias = 'eventEndDate'] != '' and umbraco.library:DateGreaterThanOrEqualToday(data [@alias = 'eventEndDate']))
                      )]" />

    The above compares two dates, but you could very easily just remove the OR clause.

    HTH,
    Nik

  • dandrayne 1138 posts 2262 karma points
    Dec 10, 2009 @ 14:17
    dandrayne
    0

    As for syntax, something like

    <xsl:for-each select="$currentPage//node/data [@nodeTypeAlias='whataver' and umbraco.library:DateGreaterThanToday(./data [@alias=''dateField])] " />

    (untested!)

    Dan

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Dec 10, 2009 @ 14:18
    Sebastiaan Janssen
    0

    Haven't done it, but you should be able to get the current date in XSLT via:

    <xsl:value-of select="Exslt.ExsltDatesAndTimes:date()"/>
    

    Also a date diff is available:

    <xsl:value-of select="Exslt.ExsltDatesAndTimes:difference('String start', 'String end')"/>
    
  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Dec 10, 2009 @ 14:19
    Sebastiaan Janssen
    0

    Hehe, well, that was fast, I should check if other people have answered already ;-) At least I picked up a new technique from this. :D

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Dec 10, 2009 @ 14:42
    Nik Wahlberg
    0

    @Sebasitan Hey, so did I. Thanks for sharing the Exslt method as well.

  • Lee 1130 posts 3088 karma points
    Dec 10, 2009 @ 17:19
    Lee
    0

    Awesome you have to love this place!!  Thanks chaps, I'll have a play and mark the one that worked best for me as the answer 

    Thanks again for all the replies

Please Sign in or register to post replies

Write your reply to:

Draft