Display containing folder Name of items find in media sections
Hi ,
In media sections i have some pdfs listed in folders like this:
Financial Informations - Finance - pdf 1 - pdf 2 - Annual Reports - pdf 1 - pdf 2
For now am already listing the pdfs using a media picker and some xslt. But I want also to display the sub folder name for e.g If am listing pdf1. pdf 2 from folder finance ....display this folder name in the front end
Display containing folder Name of items find in media sections
Hi ,
In media sections i have some pdfs listed in folders like this:
Financial Informations
- Finance
- pdf 1
- pdf 2
- Annual Reports
- pdf 1
- pdf 2
For now am already listing the pdfs using a media picker and some xslt. But I want also to display the sub folder name for e.g If am listing pdf1. pdf 2 from folder finance ....display this folder name in the front end
Finance
pdf 1
pdf 2
etc..
Any help.
<xsl:variable name="mediaDoc" select="/macro/pdfFiles"/>
<xsl:template match="/">
<xsl:if test="$mediaDoc">
<xsl:variable name="mediaItems" select="umbraco.library:GetMedia($mediaDoc/*/@id, true())"/>
Problem here : am only able to display top contianing folder with that commented code below:
<!--<xsl:value-of select="umbraco.library:GetMedia($mediaItems/@parentID, 1)/@nodeName"/>-->
<div class="docCn">
<div id="docMnu">
<ul>
<xsl:for-each select="$mediaItems/Pdf">
<xsl:sort select="@nodeName" order="ascending" />
<xsl:variable name="size" select="./umbracoBytes" />
<xsl:variable name="sizeAndSuffix">
<xsl:choose>
<xsl:when test="$size >= 1073741824">
<xsl:value-of select="format-number($size div 1073741824,'#,###')"/>
<xsl:text> GB</xsl:text>
</xsl:when>
<xsl:when test="$size >= 1048576">
<xsl:value-of select="format-number($size div 1048576,'#,###')"/>
<xsl:text> MB</xsl:text>
</xsl:when>
<xsl:when test="$size >= 1024">
<xsl:value-of select="format-number($size div 1024,'#,###')"/>
<xsl:text> KB</xsl:text>
</xsl:when>
<xsl:when test="$size > 0 and $size < 1024">
<xsl:value-of select="format-number($size div 0,'#,###')"/>
<xsl:text> Bytes</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>0 Bytes</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<li>
<a href="{umbracoFile}" target='_blank'>
<xsl:value-of select="@nodeName"/>
<span class="sizedoc"> {<xsl:value-of select="$sizeAndSuffix"/>}</span>
</a>
</li>
</xsl:for-each>
</ul>
</div>
</div>
</xsl:if>
</xsl:template>
Thks
//Sam
Hi Sam,
Maybe this post can give you some inspiration to find a solution.
http://our.umbraco.org/forum/developers/xslt/30685-Display-Folder-Name-and-Its-Sub-Folders-from-Media-Section
/Dennis
Ok solved it. my mistake i was searching for parent Id when i only needed node id
Replaced that:
<xsl:value-of select="umbraco.library:GetMedia($mediaItems/@parentID, 1)/@nodeName"/>
with that:
<xsl:value-of select="umbraco.library:GetMedia($mediaItems/@id, 1)/@nodeName"/>
is working on a reply...