Copied to clipboard

Flag this post as spam?

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


  • Fergus Davidson 309 posts 588 karma points
    Jan 28, 2010 @ 11:39
    Fergus Davidson
    0

    reusable content

    hi

    i am new to umbraco and i need some advice on how to structure my content.

    i am working on a simple site, the homepage of which has a promo area on it.

    At the moment i have set it up so that the user can select a new background image and enter some text, the promo area then has this new image as a background on the promo div, with the text positioned over it.

    this works fine, but what i would like to do is to save the background image/text combinations as 'promos'. the user could add, then, any number of promos and then on the homepage, just select one of them using a content picker.

    any advice would be most welcome

     

    thanks

  • dandrayne 1138 posts 2262 karma points
    Jan 28, 2010 @ 11:49
    dandrayne
    0

    Yes, this is completely doable.

    I'd have another area of the content tree as a "folder" to hold document types called "Promos" or similar.  This document type would consist only of the text area and the background image (or whatever else you need), then have a content picker on your homepage document type that allows you to select the promo to use.  Something like the following

    <xsl:variable name="promoId">
    <xsl:value-of select="$currentPage/data [@alias'YOUR_PROMO_PICKER']" />
    </xsl:variable>

    (you may want to have some checking in here, provide a default promo of none chosen etc)

    Then grab the promo node using something like the following

    <xsl:variable name="promo" select="umbraco.library:GetXmlNodeById($promoId) "/>

    Then you can just access the promo properties as with "currentPage"

    <xsl:value-of select="$promo/data [@alias='YOUR_PROMO_TEXT']" />

    Dan

  • Fergus Davidson 309 posts 588 karma points
    Jan 28, 2010 @ 16:54
    Fergus Davidson
    0

    perfect, thanks so much

     

  • 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.

Please Sign in or register to post replies