I'm not quite sure I understand what you mean when you say "without the media picker at the top document"? You could, without any problems, have a media picker on all of your nodes if that's what you are asking for. Oyherwise could you try to explain your question a little more :)
Get a media files from any place in the doc tree?
Hi
I want a macro like this:
<umbraco:Macro propertyAlias="ImageTop" Alias="ShowImage" runat="server"></umbraco:Macro>
The macro must seek "media" files through and get the url to show the file white the alias "ImageTop".
I am on a Umbraco v 4.7
This is working, but just at top level of the doc tree:
i know this is the error: select="$currentPage/* [name()=$propertyAlias]"/>
<xsl:template match="/">
<xsl:variable name="propertyAlias" select="/macro/propertyAlias"/>
<xsl:variable name="propertyValue" select="$currentPage/* [name()=$propertyAlias]"/>
<xsl:if test="$propertyValue!=''">
<xsl:variable name="mediaItem" select="umbraco.library:GetMedia($propertyValue, 'false')"/>
<xsl:if test="$mediaItem!=''">
<img>
<xsl:attribute name="src">
<xsl:value-of select="$mediaItem/umbracoFile" />
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="$mediaItem/@nodeName" />
</xsl:attribute>
</img>
</xsl:if>
</xsl:if>
</xsl:template>
Hi John
So your media picker is located at the top most node in your content tree?
If that's the case try chagint his line:
$currentPage/* [name()=$propertyAlias]"/>
to this
$currentPage/ancestor-or-self::*[@level='1']/* [name()=$propertyAlias]"/>
Does that work for you?
/Kim A
Yes, it works!, and yes I have the media picker at the top - Thanks :-)
Is it possible to search the media lib, without the "media picker" at the top dockument?
You're welcome John!
I'm not quite sure I understand what you mean when you say "without the media picker at the top document"? You could, without any problems, have a media picker on all of your nodes if that's what you are asking for. Oyherwise could you try to explain your question a little more :)
/Kim A
is working on a reply...