Copied to clipboard

Flag this post as spam?

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


  • Thomas 66 posts 88 karma points
    Nov 08, 2011 @ 09:54
    Thomas
    0

    Using member data in comment list

    I have installed Contour and is a XSLT newbie, but have started altering the commentlist example from Contour.

    I would like to insert member name and profile images form existing member profiles in comment lists, but have difficulties in writing xslt code that validates.

    The variable recordMemberID return the member ID corrently, but when inserting the variable in the getmembername Umbraco returns an error when saving "System.OverflowException: Value was either too large or too small for an Int32. "

    The code looks like this and I would like to insert the variable insetead of 1112:

    <xsl:for-each select="$records//uformrecord">
    <xsl:variable name="recordMemberID" select=".//fields/memberid//value" />

    <div class="record" style="padding-bottom:10px">
    <!-- Display 'Name' field of the record, make sure there is a field called 'Name' on the form -->
    <cite>

    <xsl:value-of select="umbraco.library:GetMemberName(1112)"/>

    </cite> Says: <br />
    <!-- Display the creation time and format it using the umbraco.library method LongDate, each record has a created node that contains the creation datetimestamp -->
    <small>
    <xsl:value-of select="umbraco.library:LongDate(./created)"/>
    </small>
    <div>
    <!-- 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>

     

     

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 08, 2011 @ 13:37
    Tim
    0

    Hi Thomas, 

    Is the member id stored as a field in your form? If so, then you could try something like:

    <xsl:value-of select="umbraco.library:GetMemberName($recordMemberID)"/>

    Check the check box to ignore checking for errors, I think that's getting thrown as when it tries to parse the XML as you sae the document, it doesn't have a value for the member id, so it's passing null to the GetMemberName function which breaks it. If you try that, does work?

  • Thomas 66 posts 88 karma points
    Nov 10, 2011 @ 09:37
    Thomas
    0

    Hi Tim

    I previously used that method, since it seem very logic. It did however return an error (both validation and xslt parsing error). It turned out, that the error was caused by old Contour records with empty memberid values.

    Thank you for the correct answer, which led to the solution.

    Thomas :o) 

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 10, 2011 @ 10:37
    Tim
    0

    No worries! Glad you got it working.

    :)

Please Sign in or register to post replies

Write your reply to:

Draft