How are you entering product1link? If it's a link to a pdf stored in the media library you'll need to do something similar to the inline xslt you already have to display the image. Or is it simply an upload field?
Here's what might work if you're using the media library to store a pdf, and a mediapicker to choose it on the page
<!-- are both these properties filled in? We don't want to get an error --> <xsl:if test="string($currentPage/data [@alias='Product1Link') != '' and string($currentPage/data [@alias='Product1Picture') != '' "> <!-- NiceUrl on our node id (only if from a mediapicker) <a href="{umbraco.library:GetMedia($currentPage/data [@alias='Product1Link'])/data [@alias='umbracoFile']}"> <img alt="Product"> <xsl:attribute name="src"> <xsl:value-of select="umbraco.library:GetMedia($currentPage/data [@alias='Product1Picture'])/data [@alias='umbracoFile']" /> </xsl:attribute> </img> </a> </xsl:if>
the code will differ very slightly for an upload field (no getmedia required)
Ahh, The dangers of just typing solutions freely, although the parser usually points out exactly what is wrong for checking. For your own reference I did this
I am an absolute newbie to Umbraco, and my problem is similar to the one discribed here. I have a picture called "card1.png" and want this picture to be a link to a pdf file called "card1.pdf". I am displaying the picture card1.png with the media picker, the property is called pic (alias: pic). I have tried to use the code here for my XSLT file and inserted the matching macro in my template, but nothing really happens. Can anyone help? I am using the 4.7.0 Version by the way.
Opening PDF Page from image link
I am new to Umbraco, and i need to open a pdf page from a image link, both the pdf and image is publish in a media picker.
this is the code that i use now, and the picture work fine, but when you click on it, it just say that it cant find the site or page:
<a href="<umbraco:Item field='Product1Link' runat='server'></umbraco:Item>">
<umbraco:Item
runat="server"
field="Product1Picture"
xslt="concat('<img src="', umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile'], '" />')"
xsltDisableEscaping="true" />
</a>
Hope someone can help me.
Hi Peder
How are you entering product1link? If it's a link to a pdf stored in the media library you'll need to do something similar to the inline xslt you already have to display the image. Or is it simply an upload field?
Here's what might work if you're using the media library to store a pdf, and a mediapicker to choose it on the page
the code will differ very slightly for an upload field (no getmedia required)
Dan
urgh, apologies: Incorrect comment and unclosed comment tag
So i just put this code in to my template, right ?
You need to create an xslt file in the developers section (right-click>create) and keep "create macro" checked.
Then use this as the xslt code
Then insert the macro into your template using the insert macro button in the template editor.
Again, this will only work if you've used a mediaPicker as your "product1link" field
Dan
Thanks for reply and help :)
but i get this error when i try to save the xslt fil:
System.Xml.Xsl.XslLoadException: Expected token ']', found ')'.
...Page/data [@alias='Product1Link' -->)<-- != '' and string($currentPage/d... An error occurred at D:\hshome\tanjushka\pdhcestate.com\xslt\633996029159628496_temp.xslt(18,1).
at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
Ahh, The dangers of just typing solutions freely, although the parser usually points out exactly what is wrong for checking. For your own reference I did this
instead of
(notice the missing ] )
Dan
I found the error :)
Hi guys,
I am an absolute newbie to Umbraco, and my problem is similar to the one discribed here. I have a picture called "card1.png" and want this picture to be a link to a pdf file called "card1.pdf". I am displaying the picture card1.png with the media picker, the property is called pic (alias: pic). I have tried to use the code here for my XSLT file and inserted the matching macro in my template, but nothing really happens. Can anyone help? I am using the 4.7.0 Version by the way.
Greets
is working on a reply...