Copied to clipboard

Flag this post as spam?

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


  • Paul A 133 posts 368 karma points
    Mar 15, 2011 @ 22:14
    Paul A
    0

    Get latest comments

    Hi all,

    Am I missing something... How do I pull back the latest few comments? I can't see physical nodes being created so can't do my normal approach... Can't find any examples either.

    (P.S. Everything is working fine, form on a document, comments being posted, comments being pulled back... I just want a 'latest comment' macro for the home page)

    Cheers,

     

  • Paul A 133 posts 368 karma points
    Mar 16, 2011 @ 12:00
    Paul A
    0

    Done. Here's the basics (will return all comments)

    <xsl:variable name="comments" select="UCommentLibrary:GetComments()//comment"/>
    <xsl:if test="count($comments) > 0">
    <h2>Latest Commentsh2>

          <ul class="latestComments">
            <xsl:for-each select="$comments">
              <li>
                  <p class="commentBody"><xsl:value-of select="umbraco.library:ReplaceLineBreaks(./message)" disable-output-escaping="yes"/>p>
                  <p class="commentDate">Posted <xsl:value-of select="umbraco.library:ShortDate(@created)"/>p>
              li>
            xsl:for-each>
          ul>
        xsl:if>
  • Paul A 133 posts 368 karma points
    Mar 16, 2011 @ 12:02
    Paul A
    0

    Some chars get messed up there.

  • eddy 43 posts 64 karma points
    Mar 16, 2011 @ 12:03
    eddy
    0

    Hi Paul,

    thanks for posting that. I too am interested in implementing such a macro on the hompage and that will certainly help me out.

    Eddy

  • Biagio Paruolo 1494 posts 1635 karma points c-trib
    Apr 05, 2011 @ 17:23
    Biagio Paruolo
    0

    So. How create link to comment page?

  • Paul A 133 posts 368 karma points
    Apr 05, 2011 @ 22:29
    Paul A
    0

    Inside your for-each you need:

    <a href="{umbraco.library:NiceUrl(@nodeid)}#comment-{current()/@mainid}">
    <xsl:value-of select="umbraco.library:GetXmlNodeById(@nodeid)/@nodeName"/>
    </a>
  • Biagio Paruolo 1494 posts 1635 karma points c-trib
    Apr 07, 2011 @ 16:54
    Biagio Paruolo
    0

    Is it possible to retrieve, in XSLT, Gravatar Image too?

  • Eran Meir 401 posts 543 karma points
    Apr 07, 2011 @ 20:05
    Eran Meir
    0

    this should be added inside the for-each block

    <img class="photo avatar avatar-32 photo" width="32" height="32" src="{UCommentLibrary:getGravatar(./email, 40, '')}" alt="Gravatar of {./name}"/>
  • Biagio Paruolo 1494 posts 1635 karma points c-trib
    Sep 19, 2012 @ 16:40
    Biagio Paruolo
    0

    Sorting by date

    <xsl:sort select="umbraco.library:FormatDateTime(@created, 'yyyy/MM/dd')" order="descending" />

  • 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