Copied to clipboard

Flag this post as spam?

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


  • Kristian Frost 18 posts 102 karma points
    Sep 07, 2009 @ 13:04
    Kristian Frost
    0

    How to display latest posts

    How can I make a macro that displays all the latest posts fromm all forums/topics? Just like the Our umbraco mainpage.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 07, 2009 @ 13:12
    Dirk De Grave
    1

    Hi Kristian,

    It could be something similar to:

    <xsl:for-each select="$currentPage//node [@nodeTypeAlias = 'forumPostAlias']">
      <xsl:if test="position &lt; $numberOfItems">
        <xsl:value-of select="@nodeName"/>
      </xsl:if>
    </xsl:for-each>

    Key is to use the '//' selector (which selects all children - regardless of their level) instead of '/'. Of course, you'll have to take care of setting starting page (used $currentPage) and declaring the variable numberOfItems and set it to whatever number you'd like, and replacing 'forumPostAlias' with alias of a forum post.

     

    Hope this helps.

    Regards,

    /Dirk

  • Roel Snetselaar 151 posts 305 karma points
    Sep 07, 2009 @ 15:01
  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Sep 08, 2009 @ 10:44
    Morten Bock
    0

    Forum posts are kept in a database, and not in the node structure, so the above won't work for uForum.

    I think there is an XSLT extension for getting all posts. Take a look there. 

  • Andrew 142 posts 98 karma points
    Feb 11, 2011 @ 14:12
    Andrew
    0

    Hi I am trying to access the latest forum posts/updates using the xslt extension - uForum:LatestTopics, however I am having problems accessing the variables through xslt. This is what i have so far:

    <xsl:variable name="utopics" select="uForum:LatestTopics('10')"/>
      <xsl:for-each select="$utopics/topics">
         <xsl:value-of select="./urlname" disable-output-escaping="yes"/>
         <a title="" href="{umbraco.library:NiceUrl(@parentid)}"><xsl:value-of select="./urlname"/></a>
     </xsl:for-each>

    This is a real stab at what I am hoping to achieve, but is unfortunately not working. Any guider or pointers would be greatly appreciated

    thanks

    Andrew

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Feb 12, 2011 @ 08:19
    Morten Bock
    0

    I think you need to do this:

    <xsl:for-each select="$utopics/topics/topic">

Please Sign in or register to post replies

Write your reply to:

Draft