Copied to clipboard

Flag this post as spam?

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


  • Kim Rasmussen 81 posts 310 karma points
    Feb 18, 2013 @ 11:13
    Kim Rasmussen
    0

    Show list of comments - multilanguage

    Hi,

    I want to show a list of comments, but my problem is that my fields are called #Comment-Comment, #Comment-Name because the site is multilanguage ...

    I have tried this razorscript:

    @inherits umbraco.MacroEngines.DynamicNodeContext
    
    @using Contour.Addons.DynamicObjects
    
    <div id="comments" class="row">
    
    @foreach (dynamic record in Contour.Addons.DynamicObjects.Library.GetApprovedRecordsFromPage(@Model.Id).OrderBy("Created"))  
     {
         <div class="six columns">
             <div>
                 <i class="icon-quote-left">@Html.Raw("")</i>
                 @record.Comment.ToString()  
                 <span>@record.Name.ToString() - @record.Created.ToString("dd MMMM yyy")</span> 
            </div>     
         </div>
      }
    </div>

     

    And I don't know have to modify this XSLT to get the name field (#Comment-Name) for example:

    <xsl:variable name="records" select="umbraco.contour:GetApprovedRecordsFromPage($currentPage/@id)/uformrecord[state = 'Approved']" />
    
        <!-- Display the number of records -->
        <div id="recordscount">
          <xsl:choose>
            <xsl:when test="count($records) = 0">
              (0) comments
            </xsl:when>
            <xsl:when test="count($records) = 1">
              (1) comment
            </xsl:when>
            <xsl:otherwise>
              (<xsl:value-of select="count($records)"/>)  Comments
            </xsl:otherwise>
          </xsl:choose>
        </div>
    
    
        <textarea><xsl:copy-of select="umbraco.contour:GetRecordsFromForm('7a307e8c-d592-4dd8-a6ba-0e711f4a9b2e')"/></textarea>
    
    
        <div id="records">
    
          <!-- Loop all records -->
          <xsl:for-each select="$records">
            <div class="record">
                <div class="commentTxt">
                    <!-- Display 'Comment' field of the record, make sure there is a field called 'Comment' on the form -->
    
                     <xsl:value-of select="umbraco.library:ReplaceLineBreaks(.//fields/Comment//value)" disable-output-escaping="yes"/>
                </div>
    
            </div>
          </xsl:for-each>
    
        </div>     

    Best regards
    Kim

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Feb 18, 2013 @ 11:36
    Tim Geyssens
    0

    In razor could you try without the # so @record.Comment-Comment an if that doesn't work try @record.CommentComment

    Let me know if that does the trick

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Feb 18, 2013 @ 11:37
    Tim Geyssens
    100

    Same for xslt try without the # and withough the -

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Feb 18, 2013 @ 11:38
    Tim Geyssens
    0

    btw the dynamic object are part of Contour if you use v3 and up (not sure the addons you are using support the dictionary)

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Feb 18, 2013 @ 11:41
    Tim Geyssens
    0

    Well for the xslt one you should be able to see the xml in the textarea

    <textarea><xsl:copy-ofselect="umbraco.contour:GetRecordsFromForm('7a307e8c-d592-4dd8-a6ba-0e711f4a9b2e')"/></textarea>

    So that should show you how the element is named

  • Kim Rasmussen 81 posts 310 karma points
    Feb 18, 2013 @ 13:00
    Kim Rasmussen
    0

    Hi Tim,

    The xslt works with:

    <xsl:value-of select="umbraco.library:ReplaceLineBreaks(.//fields/commentcomment//value)" disable-output-escaping="yes"/>

    For the field '#Comment-Comment' - So that's great!

    Sadly, I didn't get the Razor script to work :( Even with different combinations of @record.Comment-Comment

    But Thanks for your help!

  • 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