Trouble with getting media out using unbuilt functions
Hello again guys/girls,
Firstly thanks for the information you've given me so far on various other issues i've had.
However, I'm seeking some more advice on pulling media out of the media library...
Basically how i've got the system setup is by having a doc type with media picker (with alias of "rightAds"), I then go from the content section, pick the media with the media picker (on its own tab)
Now... with the media picked I can surely reference it to the template?
The way I'm doing it (must be wrong as it's not working)
This is extended from a master page template which possitions it on the right
Now, the alias rightAds is from the media picker being passed into it. I can't figure out how this would pull the media out from the ID being returned?
to use the xslt Dan described, you need to create a macro. Go to the developer-section and right-click XSLT and Create a new one. (Just choose clean-file and have 'create macro checked')
Then, overwrite the xslt with the xslt that Dan wrote.
In your template, instead of umbraco:Item, you must insert a macro. (There's a button at the top where you can automatically insert a macro).
Trouble with getting media out using unbuilt functions
Hello again guys/girls,
Firstly thanks for the information you've given me so far on various other issues i've had.
However, I'm seeking some more advice on pulling media out of the media library...
Basically how i've got the system setup is by having a doc type with media picker (with alias of "rightAds"), I then go from the content section, pick the media with the media picker (on its own tab)
Now... with the media picked I can surely reference it to the template?
The way I'm doing it (must be wrong as it's not working)
This is extended from a master page template which possitions it on the right
[code]
<asp:content ContentPlaceHolderId="RightAdvertisements" runat="server">
<umbraco:Item runat="server" field="rightAds" xslt='<xsl:value-of select="umbraco.library:GetMedia(./data [@alias = "rightAds"], "false")"/>' XsltDisableEscaping="true" />
</asp:content>
[/code]
Now, the alias rightAds is from the media picker being passed into it. I can't figure out how this would pull the media out from the ID being returned?
Any help is muchly appreciated.
Thank you very much in advance,
Shaun
I prefer straight xslt instead of inline, so here's a solution for that
I think the trick here is that GetMedia returns the media item node, not just the path to the file (thats /data [@alias='umbracoFile']
Dan
Hello Dan, how would I then refference this for the <umbraco:Item> And of course where would I put this big chunk of XSLT code?
And, How would this then interact/link with the <umbraco:Item attribute?
I ideally need to know this for future refference, and so I know why and how it works.
Thank you very much for your input Dan.
Shaun
Shaun,
to use the xslt Dan described, you need to create a macro. Go to the developer-section and right-click XSLT and Create a new one. (Just choose clean-file and have 'create macro checked')
Then, overwrite the xslt with the xslt that Dan wrote.
In your template, instead of umbraco:Item, you must insert a macro. (There's a button at the top where you can automatically insert a macro).
Does this help you further?
Peter
Thank you Peter, this has helped me solve the issue.
thanks for the elaboration peter, and good luck shaun.
Just to go sith the other solution, you could also use the inline xslt:
http://umbraco.org/documentation/books/inline-xslt
is working on a reply...