Copied to clipboard

Flag this post as spam?

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


  • dunc85 39 posts 42 karma points
    Oct 13, 2010 @ 17:44
    dunc85
    0

    ListNewsEvents.xslt

    It seems that the following bit of XSLT doesn't work correctly:


    <!-- Date Format: 15.12.08 -->
                            <xsl:choose>
                                <xsl:when test="current()/@nodeTypeAlias = 'EventItem'">
                                    <xsl:value-of select="umbraco.library:FormatDateTime(data [@alias='eventDate'], 'dd.MM.yy')"/>
                                </xsl:when>
                                <xsl:otherwise>
                                    <xsl:value-of select="umbraco.library:FormatDateTime(@createDate, 'dd.MM.yy')"/>                   
                                </xsl:otherwise>
                            </xsl:choose>

     

    For the event 'Codegarden 09' the date displayed on the News page should be 22.06.09 (the event date) but it instead shows 27.02.09 (the create date). This is on version 2.0.2.

  • dunc85 39 posts 42 karma points
    Oct 13, 2010 @ 17:49
    dunc85
    0

    Sorted it

    <xsl:when test="current()/@nodeTypeAlias = 'EventItem'">

    should be:

    <xsl:when test="current()/@nodeTypeAlias = 'CWS_EventItem'">

  • Warren Buckley 2087 posts 4568 karma points MVP 6x admin hq c-trib
    Oct 13, 2010 @ 17:53
    Warren Buckley
    0

    Hiya,
    Yes you beat me to it, due to a typo with the node type alias (ie missing the CWS_ prefix which are on all document types)
    Well I might say this is in an intentional error in the future and say its a way for people to learn Umbraco easier ;)

    Warren

  • Andraž 45 posts 65 karma points
    Nov 09, 2010 @ 06:53
    Andraž
    0

    Hi,

     

    is there a way that I could add at the ListNewsEvents.xslt a limit of showing only 3 Items like at the NewsEventsSubNavi.xslt?

    If I add the variable <xsl:variable name="noOfItems" select="3" />, where do I insert it then?

     

    Regards,

    Andra


  • Warren Buckley 2087 posts 4568 karma points MVP 6x admin hq c-trib
    Nov 09, 2010 @ 09:28
    Warren Buckley
    0

    Hello Andra,
    If you do a bit of comparison work you should be able to figure this out.

    However if you put the variable towards the top of the file, just to make life easy in order to find it and change it later on.

    In the <xsl:for-each> where we are listing out each item you need to insert an <xsl:if> inside it.
    For example

    <xsl:for-each ...>
      <xsl:if test="position() <= $noOfItems">
         Stuff in here you want to do for each item
      </xsl:if>
    </xsl:for-each>

    Hope this helps
    Warren

  • Andraž 45 posts 65 karma points
    Nov 09, 2010 @ 09:36
    Andraž
    0

    Hi Warren,

    yes this helped...It's working fine now. Thanks for your quick reply and help.

    Regards,

    Andra

  • Andraž 45 posts 65 karma points
    Nov 10, 2010 @ 10:53
    Andraž
    0

    Hey,

    sorry for writting again, I have one question regarding the restriction (limit) of items displayed in NewsEventsSubNavi.xslt. If I'm correct there are now displayed the first three created events or news by date. Is there a way that there would be displayed the last three events or news by publish date?

    Regards,

    Andra

  • Warren Buckley 2087 posts 4568 karma points MVP 6x admin hq c-trib
    Nov 10, 2010 @ 11:04
    Warren Buckley
    0

    Hey Andra,
    In the XSLT underneath the <xsl:for-each> there is a <xsl:sort> you just need to update it with the value you wish to sort on.

    <xsl:sort select="@createDate" order="ascending"/>

    Change this to

    <xsl:sort select="@updateDate" order="ascending"/>

    This will use the date of when an item is updated (published). So if you create a news item in the past and go back and republish it, it will go to the top of the list. Hence my choice to use @createDate iver  @updateDate

    Thanks,
    Warren :)

Please Sign in or register to post replies

Write your reply to:

Draft