Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
HI every one.
umbraco v 4.11.3
I have this small challenge, im sure it is quiet simple, but i cant see how
I have this structure of my site.
Each product has a media picker. It is used ti select an image presenting the category
I set the image here
My problem is i get the same picture on all the categories, even if i choose different images. It displays only the one from the first.
I quiet sure i should add (@id) to the xslt on this line
<img src="{$mediaNode/umbracoFile}" alt="[image]" height="{umbracoHeight}" width="{umbracoWidth}"/>
But i cant get it to work :-(
<xsl:variable name="level" select="2"/> <xsl:template match="/"> <ul id="ts-display-pf-filterable" class="image-grid"> <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li class="shapes"> <div class="ts-display-pf-img"> <a class="image" href="{umbraco.library:NiceUrl(@id)}"> <span class="rollover" disable-output-escaping="yes"> </span> <xsl:variable name="mediaId" select="number($currentPage/categoryImage)" /> <xsl:if test="$mediaId > 0"> <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" /> <xsl:if test="$mediaNode/umbracoFile"> <img src="{$mediaNode/umbracoFile}" alt="[image]" height="{umbracoHeight}" width="{umbracoWidth}"/> </xsl:if> </xsl:if> </a> </div> <div class="ts-display-pf-text"> <h3><a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a></h3> <span><xsl:value-of select="categoryTeaser" disable-output-escaping="yes"/></span> </div> <div class="ts-display-clear"></div> </li> </xsl:for-each> </ul> </xsl:template>
Hi Again
I have been looking in to this and it behaves strange.
The reason why i get the same image on all categories is that i picks the first image on the parent node
Here i have set the image Product on the products node
The out put is this, it gets the image from "Products" and the text from the right nodes.
How do i get it to pick the media from the current node and not the parent.
Tanks for this great forum!!!!
Kindly René
Hi again
Found the error :-)
This is the coode that works
<xsl:variable name="mediaId" select="number(./categoryImage)" /> <xsl:if test="$mediaId > 0"> <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" /> <xsl:if test="$mediaNode/umbracoFile"> <img src="{$mediaNode/umbracoFile}" alt="[image]" height="{umbracoHeight}" width="{umbracoWidth}"/> </xsl:if> </xsl:if>
In this line of code i needed (./categoryImage) instead of this ($currentPage/categoryImage)
<xsl:variable name="mediaId" select="number(./categoryImage)" />
Hope tis can help someone else
Have a nice day
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
GetMedia from different nodes
HI every one.
umbraco v 4.11.3
I have this small challenge, im sure it is quiet simple, but i cant see how
I have this structure of my site.
Each product has a media picker. It is used ti select an image presenting the category
I set the image here
My problem is i get the same picture on all the categories, even if i choose different images.
It displays only the one from the first.
I quiet sure i should add (@id) to the xslt on this line
But i cant get it to work :-(
Hi Again
I have been looking in to this and it behaves strange.
The reason why i get the same image on all categories is that i picks the first image on the parent node
Here i have set the image Product on the products node
The out put is this, it gets the image from "Products" and the text from the right nodes.
How do i get it to pick the media from the current node and not the parent.
Tanks for this great forum!!!!
Kindly René
Hi again
Found the error :-)
This is the coode that works
In this line of code i needed (./categoryImage) instead of this ($currentPage/categoryImage)
Hope tis can help someone else
Have a nice day
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.