Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi All,
This probably such a simple thing to do but I can't for the life of me work out how to do it
So far I have:
<xsl:value-of select="count(umbraco.library:GetMedia(2115,'true')/node [string(data [@alias = 'umbracoExtension']) = 'pdf'])"/>
But I keep on getting 0 when there are about 150 in there and its beginning to drive me mad!!
Any help much appreciated
Tom
Hi Tom
What about changing the 'true' to a simple 1 as in
<xsl:value-of select="count(umbraco.library:GetMedia(2115,1)/node [string(data [@alias = 'umbracoExtension']) = 'pdf'])"/>
or you can try this approach:
<xsl:variable name="images" select="umbraco.library:GetMedia(2115, 1)" /><xsl:variable name="numberOfImages" select="count($images/node)" />
Hope it helps
/Finn
Be aware of the performance penalty if you have a large number of media items!
Also, not sure whether GetMedia() returns a flat structure of nodes. If not, one may switch to //node instead of /node in the count() method.
Hope this helps.
Regards,
/Dirk
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Count number of media items with specific extension
Hi All,
This probably such a simple thing to do but I can't for the life of me work out how to do it
So far I have:
But I keep on getting 0 when there are about 150 in there and its beginning to drive me mad!!
Any help much appreciated
Tom
Hi Tom
What about changing the 'true' to a simple 1 as in
or you can try this approach:
Hope it helps
/Finn
Be aware of the performance penalty if you have a large number of media items!
Also, not sure whether GetMedia() returns a flat structure of nodes. If not, one may switch to //node instead of /node in the count() method.
Hope this helps.
Regards,
/Dirk
is working on a reply...