From: Marc P. <ma...@an...> - 2003-04-21 16:09:58
|
On Mon, 21 Apr 2003 07:32:44 -0700, Lane Sharman <la...@op...> wrote: > > > Marc Palmer wrote: > >> >> Ah, a fresh new thread :-) >> >> >> #foreachnode $node in $mytreeData topdown filtering ( $node.IsText && >> ($node.Parent.Name == "description")) >> $node.Value >> #end > > > I actually like the aboove. If $myTreeData were to implement an interface > it would follow the KISS principle in WM and it would provide a lot of > power to the Web Head who has to deal with an tree structure. Yes, I think so. I think however that I prefer not requiring a specific interface (nothing else in WM does) and using an extra clause I forgot to include: #foreachnode $node in $mytreeData topdown filtering ( ... ) children in $node.Children $node.Value #end Thus we tell the directive what property will return a list (array/iter/enum) of children for the nodes. No interface required. Perhaps this would need to take the form of "children in 'Children'" so that the template writer cannot write $someUnrelatedObject.Children because that would result in infinite looping. > good new thread, Marc! Thanks :) The beauty of this directive approach is that you can omit the filtering keyword and get a full flattened view of the tree - solving both problem scenarios in one go. #foreachnode $loopVar in $srcData children in $propertyName [topdown | leftright] [filtering (expr)] Marc -- Marc Palmer (Wangjammer5) http://www.wangjammers.org Java Consultants |