CodeGarden 10: The sixth annual Umbraco Developer Conference
June 23-25th 2010 - free ASP.NET MVC pre-conference. Register today!

recursive properties

1/5/2010 10:06:57 AMAvatarEdward DudleyLocation: Basel, Switzerlandposts: 73Karma: 113

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:

umbraco.org/.../advanced-parameter-syntax

forum.umbraco.org/...play-a-field-recursively.aspx

1/5/2010 1:17:09 PMAvatarChriztian SteinmeierLocation: Brabrand Denmarkposts: 124Karma: 270
Comment with ID: 22476

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 

1/28/2010 8:10:15 AMAvatarJonas ErikssonLocation: Hudiksvall, Swedenposts: 279Karma: 461
Comment with ID: 24589

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

2/2/2010 9:23:59 AMAvatarEdward DudleyLocation: Basel, Switzerlandposts: 73Karma: 113
Comment with ID: 25103

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.

2/5/2010 5:26:11 PMAvatarJonas ErikssonLocation: Hudiksvall, Swedenposts: 279Karma: 461
Comment with ID: 25531

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 login or Sign up To post replies