I'm working on a large multi-site install at the moment for a group. The group site needs to list out all root nodes as each root is one of the subsiduary sites. I can get the current root node using Model.AncestorOrSelf() however I want all the sibling nodes also?
I've looked into the code and also realized to my surprise that "-1" is supposed to work. That's not true, however for media - for content "-1" is a real node in the umbraco.config xml file, so that in the content tree. In the case of media "-1" is nothing - just a number to mark top-level media nodes that have no parent.
List All Root Nodes
I'm working on a large multi-site install at the moment for a group. The group site needs to list out all root nodes as each root is one of the subsiduary sites. I can get the current root node using Model.AncestorOrSelf() however I want all the sibling nodes also?
Thanks, Simon
OK after some experimentation and a quick peek at umbraco.config I tried to get the node with id -1 and it works:
I guess something like:
could work.
Hmm interesting that NodeById(-1) works. Wonder if the same goes for media. With the umbraco.library methods it didn't work. I had to do it a lot harder like this: http://our.umbraco.org/forum/developers/razor/27521-Get-All-Images-in-Media-Gallery#comment102996
Jeroen
I've looked into the code and also realized to my surprise that "-1" is supposed to work. That's not true, however for media - for content "-1" is a real node in the umbraco.config xml file, so that in the content tree. In the case of media "-1" is nothing - just a number to mark top-level media nodes that have no parent.
is working on a reply...