Copied to clipboard

Flag this post as spam?

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


  • Edward Dudley 80 posts 121 karma points
    Jan 05, 2010 @ 10:06
    Edward Dudley
    0

    Recursive Properties

    I've started using properties recursively a lot recently and it's really useful (both with the Macro syntax and in XSLT - see links at end in case anyone gets here through a google search looking for more info on recursion in Umbraco).

    What is a pain though is having to click up through a tree to find out what is set where.

    I know this could be done as a page with XSLT, etc. but could a button be added which would show you the values of properties if they were to be used recursively and also the name of the node where the property is set?

    Maybe an example would better illustrate why this would be useful.  If this was your scenario:

    Node 1 (Value: 1)

    - Node 2 (Value: blank)

    - - Node 3 (Value: 0, set by accident or by an unexperienced user)

    - - - Node 4 (Value: blank)

    - - - - Node 5 (Value: blank)

    And you wanted to know why the property value at node 5 was 0, currently you would have to click into each node, onto the relevant tab and check what is set at each level.  If there was a button that you could click that gave the information:

    Value set as '0' at 'Node 3'  "

    Then this would make debugging site content much quicker!

     

    Links:

    http://umbraco.org/documentation/books/macro-parameters-syntax/advanced-parameter-syntax

    http://forum.umbraco.org/yaf_postst2751_XSLT-Tip--Display-a-field-recursively.aspx

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Jan 05, 2010 @ 13:17
    Chriztian Steinmeier
    1

    Hi Edward,

    Seems like this would be a neat little addition to my XML Dump package - shouldn't be too hard to implement... will try to squeeze it into next version.

    /Chriztian 

  • Jonas Eriksson 930 posts 1825 karma points
    Jan 28, 2010 @ 08:10
    Jonas Eriksson
    0

    Hi!

    You could easily add another row with some info about the node where the value was found.

    Email:<xsl:value-of select="$currentPage/ancestor-or-self::node [string(data[@alias='EmailAddressToResponsibleEditor'])!=''] [position()=last()] /data[@alias='EmailAddressToResponsibleEditor']"/>,
    Found at:<xsl:value-of select="$currentPage/ancestor-or-self::node [string(data[@alias='EmailAddressToResponsibleEditor'])!=''] [position()=last()] /@nodeName"/>

    Btw, that recursive syntax is very useful, the whole Neehouse forum post should be in the wiki.

    Regards

    Jonas

  • Edward Dudley 80 posts 121 karma points
    Feb 02, 2010 @ 09:23
    Edward Dudley
    0

    Thanks @Jonas - I guess that would be one way to do it.  You wouldn't want that information on a live site though.  Maybe you could put it in an altTemplate but I still think it would be better to see at a glance in the Umbraco back end.  I definitely agree the post should be in the wiki though.

    Perhaps if a property was empty there could be a message below: "If used recursively value would be x set at node y".  Or a button that would display an alert / popup with the information.

     

    @Chriztian - I'll take a look! Thanks.

  • Jonas Eriksson 930 posts 1825 karma points
    Feb 05, 2010 @ 17:26
    Jonas Eriksson
    0

    Edward, yes, I meant only during debugging. If you want to do invisible live debugging, another easy trick is to use xsl comment to get the data inside <!-- -->.

     

    Email:<xsl:value-of select="$currentPage/ancestor-or-self::node [string(data[@alias='EmailAddressToResponsibleEditor'])!=''] [position()=last()] /data[@alias='EmailAddressToResponsibleEditor']"/>,
    <xsl:comment>Found at:<xsl:value-of select="$currentPage/ancestor-or-self::node [string(data[@alias='EmailAddressToResponsibleEditor'])!=''] [position()=last()] /@nodeName"/></xsl:comment>
    Regards/J

     

Please Sign in or register to post replies

Write your reply to:

Draft