First off, this is my first time using contour and I am well impressed. Well done on an excellent product. I think from now on all my clients will need to get this by default!
Anyway - onto my question at hand. I have looked at the sample xslt for displaying comments, but am wanting to modify it slightly to suit my needs. What I am wanting to do is the following:
1. get comments from current page and all pages underneath
2. display x random comments (where x is a macro defined value)
I think i could possibly work out how to get the x random part right, but am not sure about point 1. Any help would be greatly appreciated
thanks in advance
Andrew
Here is the original xslt:
<xsl:param name="currentPage"/> <xsl:template match="/"> <!-- To use this sample out of the box, you'll have to have a form on the page that has a 'Name' and a 'Comment' field --> <!-- Get all approved records of the current page by using the library method GetApprovedRecordsFromPage -->
<!-- Display the number of records --> <div id="recordscount" style="padding-bottom:10px"> <xsl:choose> <xsl:when test="count($records//uformrecord) = 0"> No comments </xsl:when> <xsl:when test="count($records//uformrecord) = 1">1 comment </xsl:when> <xsl:otherwise> <xsl:value-of select="count($records//uformrecord)"/> comments </xsl:otherwise> </xsl:choose> </div>
<div id="records"> <!-- Loop all records --> <xsl:for-each select="$records//uformrecord"> <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=".//fields/name//value"/> </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 -->
undefined
Hi All
First off, this is my first time using contour and I am well impressed. Well done on an excellent product. I think from now on all my clients will need to get this by default!
Anyway - onto my question at hand. I have looked at the sample xslt for displaying comments, but am wanting to modify it slightly to suit my needs. What I am wanting to do is the following:
1. get comments from current page and all pages underneath
2. display x random comments (where x is a macro defined value)
I think i could possibly work out how to get the x random part right, but am not sure about point 1. Any help would be greatly appreciated
thanks in advance
Andrew
Here is the original xslt:
<xsl:param name="currentPage"/>
<xsl:template match="/">
<!-- To use this sample out of the box, you'll have to have a form on the page that has a 'Name' and a 'Comment' field -->
<!-- Get all approved records of the current page by using the library method GetApprovedRecordsFromPage -->
<xsl:variable name="records" select="umbraco.contour:GetApprovedRecordsFromPage($currentPage/@id)" />
<!-- Display the number of records -->
<div id="recordscount" style="padding-bottom:10px">
<xsl:choose>
<xsl:when test="count($records//uformrecord) = 0">
No comments
</xsl:when>
<xsl:when test="count($records//uformrecord) = 1"> 1 comment
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="count($records//uformrecord)"/> comments
</xsl:otherwise>
</xsl:choose>
</div>
<div id="records">
<!-- Loop all records -->
<xsl:for-each select="$records//uformrecord">
<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=".//fields/name//value"/> </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>
</div>
</xsl:template>
I do not know why the title says undefined - but it should say "Contour - XSLT List comments" - Admin?
solved
is working on a reply...