Copied to clipboard

Flag this post as spam?

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


  • syn-rg 282 posts 425 karma points
    May 08, 2012 @ 08:50
    syn-rg
    0

    Multiple UComment macros on the same page, in a child node list

    I have a child node list on my Latest News page, displaying content from it's child node News Items.
    The News Items are not viewable as pages, and are only displayed on the Latest News page in the child node list.

    I want to be able to add the UComment macro to each seperate list item "LI" and have the comments unique to that "LI".

    I understand that UComment's macro is created to be used only once per page, was hoping it could be manipulated to work multiple times on the same page.

    Currently I've got it displaying in all "LI's" having added the macro to the XSLT. However when I submit, it only goes to "Your comment is being submitted, please wait"... And then it doesn't pass through to "Your comment has been posted, thank you very much" So the comment doesn't submit properly, and isn't displayed in the Comments tab in the Content section.

    What can be done to get this to work? If it can work at all?

    Cheers, JV

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:UCommentLibrary="urn:UCommentLibrary" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets PS.XSLTsearch UCommentLibrary ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
    <xsl:variable name="documentTypeAlias" select="string('NewsItem')"/>
    <xsl:variable name="Node" select="$currentPage" />
    <xsl:variable name="macro">
    <xsl:text>&lt;?UMBRACO_MACRO RegisterScripts="1" macroAlias="UCommentForm" </xsl:text>
    <xsl:text>">&lt;/?UMBRACO_MACRO></xsl:text>
    </xsl:variable>
    <xsl:variable name="comments" select="UCommentLibrary:GetCommentsForNode($currentPage/@id)//comment"/>
    <xsl:template match="/">

    <!-- The fun starts here -->
      <xsl:choose>
        <xsl:when test="count($currentPage/* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1']) &gt; 0">
          <div class="latest_news_list">
            <ul>
              <xsl:for-each select="$currentPage/* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1']">
                <xsl:sort select="newsDate" order="ascending" />
                <li>
                  <div class="news_details">
                    <h3><xsl:value-of select="newsTitle"/></h3>
                    <p><xsl:value-of select="umbraco.library:FormatDateTime(./newsDate, 'dd/MM/yy')"/></p>
                  </div>
                  <!--<div class="news_description">-->
                  <div class="grey_button"><a href="">Full Story</a></div>
                  <xsl:if test="newsImage != ''">
                  <div class="news_image">
                    <img alt="">
                    <xsl:attribute name="src"> <xsl:value-of select="newsImage" /> </xsl:attribute>
                    </img>
                  </div>
                  </xsl:if>
                  <span><xsl:value-of select="newsDescription" disable-output-escaping="yes" />
                  <!--</div>-->
                    <xsl:if test="count($comments) &gt; 0">
                      <h3>
                        <xsl:value-of select="count($comments)"/> comment<xsl:if test="count($comments) &gt; 1">s</xsl:if>  for  &#8220;<xsl:value-of select="$currentPage/@nodeName"/>&#8221;
                      </h3>
                      <ol class="commentlist">
                        <xsl:for-each select="$comments">
                          <li class="comment alt" id="comment-{@id}">
                            <div class="comment-author vcard">
                              <!--<img class="photo avatar avatar-32 photo" width="32" height="32" src="{UCommentLibrary:getGravatar(./email, 40, '')}" alt="Gravatar of {./name}"/>-->
                              <span class="fn n">
                                <xsl:choose>
                                  <xsl:when test="string-length(./website) = 0">
                                    <xsl:value-of select="./name"/>
                                  </xsl:when>
                                  <xsl:otherwise>
                                    <a class="url url" rel="external nofollow" href="{./website}">
                                      <xsl:value-of select="./name"/>
                                    </a>
                                  </xsl:otherwise>
                                </xsl:choose>
                              </span>
                            </div>
                            <div class="comment-meta">
                              Posted <xsl:value-of select="umbraco.library:LongDate(@created,'true',' at ')"/>
                            </div>
                            <p>
                              <xsl:value-of select="umbraco.library:ReplaceLineBreaks(./message)" disable-output-escaping="yes"/>
                            </p>
                          </li>
                        </xsl:for-each>
                      </ol>
                    </xsl:if>
                    <xsl:value-of select="umbraco.library:RenderMacroContent($macro, $Node/@id)" disable-output-escaping="yes" />
                  </span>
                </li>
              </xsl:for-each>
            </ul>
          </div>
        </xsl:when>
      </xsl:choose>
    </xsl:template>

    </xsl:stylesheet>

     

Please Sign in or register to post replies

Write your reply to:

Draft