Copied to clipboard

Flag this post as spam?

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


  • Chris Clarke 22 posts 43 karma points
    Oct 31, 2010 @ 06:36
    Chris Clarke
    0

    UseIfEmpty and Recursive in template

    I'd like the users to set default text for web page column in the .Net Master Page but also give them the option of overriding this text on individual pages if they want.

    On my Master Page there's a field called textOnTheSide, default content has been added.

    On the local page there's a field called textOnTheSideLocal.

    In the template for the local page I added the fields via the UI;

    <umbraco:Item field="textOnTheSideLocal" useIfEmpty="textOnTheSide" recursive="true" runat="server"></umbraco:Item>

    If textOnTheSideLocal text is empty then nothing shows but there is text in the master page's textOnTheSide field.

    If I replace the field reference with;

    <umbraco:Item field="textOnTheSide" recursive="true" runat="server"></umbraco:Item>

    then the default web column text shows.

    Lastly, if I add another field onto the local page and specify that its content should be shown if the field textOnTheSideLocal is empty then the new field's contents are shown when required.

    It seems to me that the 'recursive' argument isn't used when the useIfEmpty field isn't on the currentPage.

    Or am I missing something ?

     

  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    Nov 01, 2010 @ 08:36
    Sebastiaan Janssen
    0

    You are correct.

    Just use textOnTheSide for both the local and global property and it will do a recursive call just fine.

  • Chris Clarke 22 posts 43 karma points
    Nov 04, 2010 @ 00:03
    Chris Clarke
    0

    Our mistake, the Content web page hierarchy wasn't correct.

    I was trying to use recursive against a web page's field at the same level & different branch.

    Thank-you.

Please Sign in or register to post replies

Write your reply to:

Draft