Been searching for a solution in the forum, but can't get any of it to work or i'm simply doing it wrong...
Running Umbraco 4.9, I now have a page that displays all subpages and some of their content via Xslt - no problem!
Now I just wanna make a page, that displays the full details of one of the subpages, when you click on a link. So I have created a template, that pulls out all the fields I need from my documenttype and all is dandy, but...
I have set up a media picker value "pdfFile" and when I pull the value into the template, I get the ID. The trick is to make this value into a link, so that you can view/download the selected pdf, but I can't figure out how to make the link...
I've tried several inline approaches, but no luck. Is this not possible or do I need to make a specific macro for this value and how would that look like?
Yes - should be correct; the GetMedia() method take an ID and a boolean - the {0} gets replaced with the field's contents (which should be the media ID as you've mentioned before) - the last zero is equivalent to a boolean false() (we're inside XSLT at this point) which means we don't want any child nodes that PDF file may have.
Maybe the upload field/property for the File isn't named umbracoFile? (That's the standard, but it could have been named otherwise for some reason).
Inline Xslt Media Picker ID to URL
Been searching for a solution in the forum, but can't get any of it to work or i'm simply doing it wrong...
Running Umbraco 4.9, I now have a page that displays all subpages and some of their content via Xslt - no problem!
Now I just wanna make a page, that displays the full details of one of the subpages, when you click on a link. So I have created a template, that pulls out all the fields I need from my documenttype and all is dandy, but...
I have set up a media picker value "pdfFile" and when I pull the value into the template, I get the ID. The trick is to make this value into a link, so that you can view/download the selected pdf, but I can't figure out how to make the link...
I've tried several inline approaches, but no luck. Is this not possible or do I need to make a specific macro for this value and how would that look like?
Help me Obi Wan Kenobi...
Hi Crawn,
It's possible to do as an "inline XSLT" thing, but it will be much more flexible as a separate macro. That said, here's the way to do it:
/Chriztian
Hi Chriztian... and thx for your answer!
I found those lines in another post and when i added it to my template, nothing renders out... :(
Cheers Crawn
Hi again Chriztian...
Are you sure this is correct:
the {0}, 0 does not ring a bell to me
Cheers
Hi Crawn,
Have you tried this one.
My inspiration is Chriztian´s post, and this documentation here: http://our.umbraco.org/wiki/reference/templates/umbracoitem-element/inline-xslt
Or alternatively you could try this one:
Hope this helps,
/Dennis
Hi Dennis...
Thx for your time...
Pasted both codes and both just produce a runtime error...
Read the documentation over 3 times to get it to render out anything... no luck... i'm prolly doing something very wrong, but i can't see what.
Thx for helping...
/Crawn
Hi Crawn,
Yes - should be correct; the
GetMedia()
method take an ID and a boolean - the{0}
gets replaced with the field's contents (which should be the media ID as you've mentioned before) - the last zero is equivalent to a booleanfalse()
(we're inside XSLT at this point) which means we don't want any child nodes that PDF file may have.Maybe the upload field/property for the File isn't named umbracoFile? (That's the standard, but it could have been named otherwise for some reason).
/Chriztian
Hi again Chriztian... and Dennis...
Trying to debug this i put the following into my template:
<umbraco:Item runat="server" field="opstaldfoder" />
Renders out id, in this case "1433"
<umbraco:Item runat="server" field="opstaldfoder" xslt="umbraco.library:GetMedia({0}, true())/umbracoFile" />
Renders out nothing...
Its beacause its a horse site ;) they never work right :)
is working on a reply...