Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Trine 29 posts 89 karma points
    Jun 30, 2013 @ 17:28
    Trine
    0

    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!

     

    :-) 

     

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jul 01, 2013 @ 00:23
    Lee Kelleher
    0

    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.

  • Josiah D Thoen 18 posts 63 karma points
    Jul 01, 2013 @ 05:22
    Josiah D Thoen
    100

    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

  • Trine 29 posts 89 karma points
    Aug 05, 2013 @ 22:21
    Trine
    0

    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!

Please Sign in or register to post replies

Write your reply to:

Draft