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 08, 2010 @ 10:08
    Lee
    0

    Displaying Posts By Month From Current Year Only

    I have a doctype with a DatePicker, I want to be able to create month links like so

    page.aspx?m=february or page.aspx?m=2

    And pull through all the pages that have a date in February picked, but are from the current year only - I don't want to show past or future years. So February can't show events in February 2009 or 2011 etc...

    Thought I would ask you XSLT ninja's as I'm sure one of you will have done this before.

  • Lachlann 344 posts 626 karma points
    Dec 08, 2010 @ 10:28
    Lachlann
    0

    Hi there,

    This should be do-able.

    try checking out the EXSLT date extensions:

    Exslt.ExsltDatesAndTimes:monthinyear('String d')
    Exslt.ExsltDatesAndTimes:year('String d')

    You can get the month name if you want instead of the numerical value

    Exslt.ExsltDatesAndTimes:monthname('String d')

    You can also get the query string with:

    umbraco.library:RequestQueryString('m')

     

    Hope this helps

     

    L


     

     

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Dec 08, 2010 @ 10:45
    Chriztian Steinmeier
    1

    Hi Lee,

    Using some or all of the functions Lachlann suggests you should be able to get the year and month values

    To get the pages, just select all that have a datePicker value that starts with 'YYYY-MM', e.g. (with hardcoded value): 

    <xsl:apply-templates select="$pageRoot//PageDctypeName[starts-with(dataPicker, '2011-02')]" />

    /Chriztian

  • Lee 1130 posts 3088 karma points
    Dec 08, 2010 @ 11:41
    Lee
    0

    Excellent thanks

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies