Copied to clipboard

Flag this post as spam?

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


  • Peter Bradsted Bodenhoff 27 posts 47 karma points
    Jan 14, 2010 @ 11:08
    Peter Bradsted Bodenhoff
    0

    Recursive property in template dosn't work

    I have defined two properties on my frontpage-documenttype and on my textpage-documenttype (in the Generics-tab). I have given them the same names on both doc.types: HDUpdate and HDLinks.

    I then inserted this on my textpage-template : <umbraco:Item field="HDLinks" recursive="true" runat="server"></umbraco:Item> and thought that it would show the values from the frontpage if the textpage didn't have any value... but no :o(

    Please help me!!

  • Shaun 248 posts 475 karma points
    Jan 15, 2010 @ 06:04
    Shaun
    0

    Hi Peter.

    To the best of my knowledge there's no link between properties of different document types, even if they have the same name. Umbraco wouldn't think to look at a different document type if there was nothing listed on the current one.

    I'm guessing the text page is a child of the homepage, if thats the case you can get the text page to look in the homepage's properties by writing an xslt macro containing the following.

    <xsl:if test="$currentPage/data [@alias = 'HDUpdate'] !=''>
    <!--display the property from the  text page -->
    <xsl:value-of select="$currentPage/data [@alias = 'HDUpdate']" />
    </xsl:if>
    <xsl:if test="$currentPage/parent::node/data [@alias = 'HDUpdate'] !=">
    <!--display the property from the homepage -->
    <xsl:value-of select="$currentPage/parent::node/data [@alias = 'HDUpdate']" />
    </xsl:if>
  • Shaun 248 posts 475 karma points
    Jan 15, 2010 @ 06:06
    Shaun
    0

    You'd pop that inside a new xslt file (created in the developer section), when creating the file, tick the box so it creates the macro as well. then include the macro in your text page template.

  • Lee 1130 posts 3088 karma points
    Jan 15, 2010 @ 07:23
Please Sign in or register to post replies

Write your reply to:

Draft