Copied to clipboard

Flag this post as spam?

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


  • Tizer 170 posts 201 karma points
    Dec 02, 2010 @ 06:04
    Tizer
    0

    Timed content - Page of the week

    OK - I have 4 content nodes which I are manaully choosen using content picker.

    I would like them to show 1 item at a time for 1 week only.

    At the end of the 4 week cycle, I would choose another 4.

    What is the best way to do this?

     

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Dec 02, 2010 @ 07:17
    Hendy Racher
    0

    Hi Tizer,

    Can you assume to key the start of the four week period from the publish date ? If so when rendering calculate the number of weeks from publish and show the item in the CSV of the content picker at that index.

    Here's a blog post about UltimatePicker and XSLT which covers parsing CSVs, and here's a post about comparing dates in XSLT

    HTH,

    Hendy

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Dec 02, 2010 @ 10:17
    Hendy Racher
    0

    Hi Tizer,

    Sorry, my mistake, I had assumed you're using a MultiPicker, but if you're using four seperate content pickers, it's even easier, as it's just the date compare, and then swich to render the appropriate one.

    Cheers,

    Hendy

  • Søren Tidmand 129 posts 366 karma points
    Dec 02, 2010 @ 11:09
    Søren Tidmand
    1

    Hi Tizer,

    I aggree with Hendy, but as I understand it you would like to pick out four content nodes on a regular basis with no relation to the createDate. If this is the case I would suggest adding an extra property for each of the four content pickers - type: textstring - alias weekInYear - like this:

    contentPicker_1
    weekInYear_1
    contentPicker_2
    weekInYear_2
    ....

    Then you would pick out the nodes and enter the appropriate week number for showing each node. Then in your xslt (new schema) you could add the following:

    <xsl:variable name="thisWeek" select="Exslt.ExsltDatesAndTimes:weekinyear()"/>

    <xsl:variable name="content1" select="umbraco.library:GetXmlNodeById($contentPicker_1)"/>
    <xsl:variable name="content1" select="umbraco.library:GetXmlNodeById($contentPicker_2)"/>
    <xsl:variable name="content1" select="umbraco.library:GetXmlNodeById($contentPicker_3)"/>
    <xsl:variable name="content1" select="umbraco.library:GetXmlNodeById($contentPicker_4)"/>

    <xsl:choose>
    <xsl:when test="$currentPage/weekInYear_3 = $thisWeek">
    <!-- show content picker 3 -->
    <h2><xsl:value-of select="$content3/@nodeName"/></h2>
    <xsl:value-of select="$content3/bodyText"/>
    </xsl:when>
    <xsl:when test="$currentPage/weekInYear_2 = $thisWeek">
    <!-- show content picker 2 -->
    <h2><xsl:value-of select="$content2/@nodeName"/></h2>
    <xsl:value-of select="$content3/bodyText"/>
    </xsl:when>
    <xsl:when test="$currentPage/weekInYear_1 = $thisWeek">
    <!-- show content picker 1 -->
    <h2><xsl:value-of select="$content1/@nodeName"/></h2>
    <xsl:value-of select="$content1/bodyText"/>
    </xsl:when>
    <xsl:otherwise>
    <!-- show content picker 4 because the week number will match OR you have not yet updated your method -->
    <h2><xsl:value-of select="$content4/@nodeName"/></h2>
    <xsl:value-of select="$content4/bodyText"/>
    </xsl:otherwise>
    </xsl:choose>

    I haven't tested the code, so please get back to me if it failes or you need further info. Of course I would also add a <call-template> :-) ...

    Regards,

    Søren

  • Tizer 170 posts 201 karma points
    Dec 03, 2010 @ 13:09
    Tizer
    0

    Thanks Hendy and Søren - some great info and links there...

    It shows me that I have a long way to go to learn all about umbraco.

    I'll post back with my solution

    Thanks again

Please Sign in or register to post replies

Write your reply to:

Draft