Getting matching values from children nodes not in same parent
Hello,
I'm using Umbraco 6.2.4.
My document tree has a parent node named "Pedals" that have child nodes named "PedalCategory", each of which in turn have child nodes named "Pedal." Each Pedal is looped through a macro and displayed on a page that lists all Pedals. Clicking a pedal goes to that Pedal's detail page.
There is also a parent node named "Videos" that that have child nodes named "VideoCategory", each of which in turn have child nodes named "Video."
Let's say, for example, the current Pedal (shown in Umbraco template page) viewed has Id 1200. I'm trying to create a loop that finds every Video with the property "pedalAssociated" whose value is 1200 and write it out to the page. Basically, let's find all related videos for the current Pedal, Id #1200.
Does that make sense?
I'd prefer to write this out to an Umbraco template in a foreach loop, rather than separately through Umbraco.RenderMacro.
Getting matching values from children nodes not in same parent
Hello,
I'm using Umbraco 6.2.4.
My document tree has a parent node named "Pedals" that have child nodes named "PedalCategory", each of which in turn have child nodes named "Pedal." Each Pedal is looped through a macro and displayed on a page that lists all Pedals. Clicking a pedal goes to that Pedal's detail page.
There is also a parent node named "Videos" that that have child nodes named "VideoCategory", each of which in turn have child nodes named "Video."
Let's say, for example, the current Pedal (shown in Umbraco template page) viewed has Id 1200. I'm trying to create a loop that finds every Video with the property "pedalAssociated" whose value is 1200 and write it out to the page. Basically, let's find all related videos for the current Pedal, Id #1200.
Does that make sense?
I'd prefer to write this out to an Umbraco template in a foreach loop, rather than separately through Umbraco.RenderMacro.
Thanks for any assistance!
Hey Scott,
Wouldn't you basically do something like this?
var videos = VideosFolder.Descendants("Video").Where("pedalAssociated == @0", Pedal.Id);
Where "VideosFolder" is a reference to the node where your videos are associated and "Pedal" is inside your loop of Pedals.
Robert
Robert... sorry for the late reply... that was it! I had to modify it slightly - Pedal.Id.ToString() - but otherwise, thanks!!
is working on a reply...