I'm building a site (with much help from the Umbraco community as I'm a noob) for a client. The clients aren't really code savvy so I want to spare them as much coding as possible. They want to feature all their staff on the site, so there will be up towards 100 staff photos for them to add and edit.
It works beautifully. But, does every image need its own xslt? I want to spare the client as much coding as possible. If the answer is "no, every image does need it own xslt", that's fine. I'm just wondering.
Since you are using the $currentPage the xslt will execute for each template the macro is on. So if you have 100 staff pages, one for each, there is probably a staff page template that has this macro. The currentPage will pull the image for the current page that is being viewed.
I ended up setting up xslt files for the images which appear on several pages, but the images which need to be changed on a regular basis I put in RTEs. There is probably a better way of doing this, but it works for now. :-)
I will have a look at DAMP for future referance though!
Does every image need an individual xslt?
Umbraco v.4.9.1.
I'm building a site (with much help from the Umbraco community as I'm a noob) for a client. The clients aren't really code savvy so I want to spare them as much coding as possible. They want to feature all their staff on the site, so there will be up towards 100 staff photos for them to add and edit.
This is my xslt:
<xsl:template match="/">
<xsl:variable name="practicePartner1Image" select="number($currentPage/practicePartner1Image)" />
<xsl:if test="$practicePartner1Image > 0">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($practicePartner1Image, 0)" />
<xsl:if test="$mediaNode/umbracoFile">
<img src="{$mediaNode/umbracoFile}" alt="[image]" height="{umbracoHeight}" width="{umbracoWidth}" />
</xsl:if>
</xsl:if>
</xsl:template>
It works beautifully. But, does every image need its own xslt? I want to spare the client as much coding as possible. If the answer is "no, every image does need it own xslt", that's fine. I'm just wondering.
Thanks!
:-)
Hi Trine,
You don't need create a seperate XSLT for each image, you can re-use the same XSLT/macro.
Not sure if you want to display all the staff in a single listings page, but if so, then you could do it using a single XSLT/macro.
(Let us know what you're after, hopefully we can help point you in the right direction)
Cheers, Lee.
Since you are using the $currentPage the xslt will execute for each template the macro is on. So if you have 100 staff pages, one for each, there is probably a staff page template that has this macro. The currentPage will pull the image for the current page that is being viewed.
SInce you are working with images, it might be good to check out the DAMP media picker. That way your client can see the image on each staff node in the content tree. You can also control which media folder they will begin browsing at. http://our.umbraco.org/projects/backoffice-extensions/digibiz-advanced-media-picker
Thanks guys!
I ended up setting up xslt files for the images which appear on several pages, but the images which need to be changed on a regular basis I put in RTEs. There is probably a better way of doing this, but it works for now. :-)
I will have a look at DAMP for future referance though!
is working on a reply...