I have a macro it takes one property of type mediaCurrent. I add the macro to rich text editor field and pick a folder. In the xslt i am doing the following
When i do direct GetMedia using the id selected in this 1075 i get some stuff back however attempting to use the value passed in i dont get anything because folderToShow seems to be empty any ideas?
@Tom - Surely in Ismails context this is a waist? If /macro/folderToShow is already a media node (which I belive is what mediaCurrent returns), you are pulling back the id only to do another GetMedia. He should just be able to do:
Which suggests that it doesn't pull back the contents, rather just the xml for the selected node, which means Tom is right, either of the following should work.
mediaCurrent macro issue in 4.5.1
Hello,
I have a macro it takes one property of type mediaCurrent. I add the macro to rich text editor field and pick a folder. In the xslt i am doing the following
<xsl:variable name="folderToShow" select="/macro/folderToShow"/>
<xsl:template match="/">
<xsl:copy-of select="umbraco.library:GetMedia(1075, true())"/>
<xsl:value-of select="$folderToShow"/>
<xsl:if test="$folderToShow!=''">
<xsl:copy-of select="umbraco.library:GetMedia($folderToShow, true())"/>
</xsl:if>
</xsl:template>
When i do direct GetMedia using the id selected in this 1075 i get some stuff back however attempting to use the value passed in i dont get anything because folderToShow seems to be empty any ideas?
Regards
Ismail
Doesn't mediaCurrent already return a media item? rather than it's ID?
Matt
try this macro call:
This is what I've done recently or
<xsl:variable name="folderToShow" select="/macro/folderToShow/Image/@id"/>
Thanks
Tom
Matt,
Then
<xsl:copy-of select="$folderToShow"/>
Should give me something as xml structure which it doesnt. I thought it might me because its in rich text editor but i get same result in template.
Regards
Ismail
@Tom - Surely in Ismails context this is a waist? If /macro/folderToShow is already a media node (which I belive is what mediaCurrent returns), you are pulling back the id only to do another GetMedia. He should just be able to do:
Matt
Tom,
Tried that no joy. I do recall seeing this before it just would not pass the param through.
Regards
Ismail
Matt,
Its a folder that I am picking and want to list the children.
Regards
Isamil
@Ismail - Checkout this page
http://umbraco.org/documentation/books/macro-parameters-syntax
Its says
mediaCurrent - the xml of the selected media item
Matt
Does this not work to list all images?
Matt
Matt,
Nope get nothing it seems as though the value is not being passed through /macro/folderToShow
Regards
Ismail
What about removing the * or media type from the select? eg
As I'm doing exaclty the same thing on one of my clients sites and seems to be working no problem...
Thanks
Tom
Ok, I just set it up in my test 4.5.1 instance. Given the following XSLT
I get the following output when folderToShow is pointed to a folder full of images
Which suggests that it doesn't pull back the contents, rather just the xml for the selected node, which means Tom is right, either of the following should work.
or
Matt
Matt,
This is now working totally bloody bizarre.
Regards
Isamil
You live an learn =)
Matt
I have been struggling with the same problem this morning, and appearently the folder, or better said Folder is case sensitive.
Instead of
This did the trick
Just as
With the latter I eventually found out that Folder was case sensitive and spelled with a capital F
is working on a reply...