Copied to clipboard

Flag this post as spam?

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


  • Jo 5 posts 35 karma points
    Aug 07, 2013 @ 23:49
    Jo
    0

    Select html to refresh

    Hello,
    I'm new to umbraco (monday), and i try to do something. I search for a time and did not find a good answer for my skill.


    I'm using xslt 1.0 to do this.

    I explain :

    I got a structure like :

    Home
    --Page1
    -----Sub page1
    --Page2
    -----Sub page2
    -----Sub page3

    What i do is Show in Page2 the information i enter in my template for Sub pageX, using a Xslt macro to do this.
    Information like : Name, Description and price
    So in my page i show all the information of all the sub pages like that

    In my Page2, i have a Select html with the years from 2010 to now, what i want to do is if i change the year from 2013 to 2012, i want to update the information to show only the 2012 sub page.
    For now i take the date with the @update of the page.
    And at the begin 2013 is selected.

    Over the year more sub pages can be add.

    My question is: how can i select only the sub page create in the selected year of my select html?

    If someone has a solution and can explain me how to do it, i'll be pleased.

    P.s.: I use Xslt beacause i have some problem with partial view macro

     

    On this have a good day

     

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Aug 08, 2013 @ 00:00
    Chriztian Steinmeier
    100

    Hi Jo - welcome to the forum!

    If you have a real <form> so the year of the <select> ends up in the QueryString you can filter the subpages by that year, e.g. something like this:

    <xsl:variable name="selectedYear" select="umbraco.library:RequestQueryString('year')" />
    
    <xsl:if test="$selectedYear = number($selectedYear)">
        <xsl:for-each select="$currentPage/*[@isDoc][substring(@createDate, 1, 4) = $selectedYear]">
            <!-- Do something -->
        </xsl:for-each>
    </xsl:if>
    

    /Chriztian

  • Jo 5 posts 35 karma points
    Aug 08, 2013 @ 03:29
    Jo
    0

    Thank you Chriztian, i gonna try this tomorrow.

  • Jo 5 posts 35 karma points
    Aug 08, 2013 @ 15:41
    Jo
    0

    Work like a charm now i just need to find how to change my navigation to set the current year by default in the querystring

     

    Thanks again for your help

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Aug 08, 2013 @ 16:09
    Dennis Aaen
    0

    Hi Jo,

    This should give you the current year

    umbraco.library:FormatDateTime(umbraco.library:CurrentDate(),'yyyy')

    or

    Exslt.ExsltDatesAndTimes:year()

    Hope this can help you

    /Dennis

  • Jo 5 posts 35 karma points
    Aug 08, 2013 @ 17:13
    Jo
    0

    Hi Dennis,

    yes thank you, I use it in my seach but my problem was more put this in my href but i found how i use :

    <a href="{umbraco.library:NiceUrl($currentPage/@id)}?year={umbraco.library:FormatDateTime(umbraco.library:CurrentDate(), 'yyyy')}"> 

     

Please Sign in or register to post replies

Write your reply to:

Draft