I am about to find out if it is possible to have 2 seperate contant tree's in umbraco, one on the content section and one on a custom section. As i see it i have to overwrite the Umbarco.LoadContent to set another startnode for my custom "content tree". Can someone tell me if that is possible and maby how :)
I am about to make a Calendar in Umbraco. The tree with arrangement's shall be just like the content tree, except for one thing, it schall be sortet by a generic property "startdate". My first idear was to build a custom section using the content tree, just with another start node. But i can see that isn't som easy as i expected.
My next idea is to make it direct in the content tree with a Calender document type, now my problem is the sorting. Is it possible to sort all child nodes to the node with the Calendar document type, and if it is possible how?
To have auto sorting you'd need to have an event handler on an event of the Document object, and then filter to only run on the appropriate document type's. You could use either Before_Save or After_Save, it wont really make much different, After_Save is probably the safest.
If i use the events you have surgested, then it will only sort the nodes when editing og making a new node, or what (haven't worked with events before)
Woulden it be better some how to overwrite the default Umbraco LoadContent Class, and make my oven sorting?I have looked at the code in the LoadContent class but can't figure out where i shall do the sorting.
You could get away with creating your own tree loading code (such as the loadContent), but as Aaron has suggested, an event handler would do just as fine. An overview of available events and how to use those can be found on the wiki. Some great examples for using events can be found on Richard's blog.
Btw: your method requires some db changes, event handlers do not affect the existing system.
How is the content tree designed
I am about to find out if it is possible to have 2 seperate contant tree's in umbraco, one on the content section and one on a custom section. As i see it i have to overwrite the Umbarco.LoadContent to set another startnode for my custom "content tree". Can someone tell me if that is possible and maby how :)
Thanks in advance
You may as well implement your own content tree entirely, there'll be next to no advantage obtained by inheriting loadContent as far as I can tell.
loadContent will load anything which is of the Node type (ie - using the GUID which represents a node), done via the Document API.
v4.1 allows you to specify sections of the content tree to load, but not a different type.
May I ask what's the reason you want to do that?
Right now it is possible to assign a startnode to a specific user. Everything above that node won't be shown to that user in the content-tree.
If that's what your after, that might be a much easier approach.
HTH,
Peter
Thanks for your replyes!
I am about to make a Calendar in Umbraco. The tree with arrangement's shall be just like the content tree, except for one thing, it schall be sortet by a generic property "startdate". My first idear was to build a custom section using the content tree, just with another start node. But i can see that isn't som easy as i expected.
My next idea is to make it direct in the content tree with a Calender document type, now my problem is the sorting. Is it possible to sort all child nodes to the node with the Calendar document type, and if it is possible how?
Thanks in advance!
To have auto sorting you'd need to have an event handler on an event of the Document object, and then filter to only run on the appropriate document type's. You could use either Before_Save or After_Save, it wont really make much different, After_Save is probably the safest.
Thanks for your reply!
If i use the events you have surgested, then it will only sort the nodes when editing og making a new node, or what (haven't worked with events before)
Woulden it be better some how to overwrite the default Umbraco LoadContent Class, and make my oven sorting?I have looked at the code in the LoadContent class but can't figure out where i shall do the sorting.
Thanks in advance!
You could get away with creating your own tree loading code (such as the loadContent), but as Aaron has suggested, an event handler would do just as fine. An overview of available events and how to use those can be found on the wiki. Some great examples for using events can be found on Richard's blog.
Btw: your method requires some db changes, event handlers do not affect the existing system.
Hope this helps.
Cheers,
/Dirk
Tanks again for reply :)
Now i have made a event (BeforeNodeRender), and now i want to reorder my tree, here is my method :)
public void BaseTree_BeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
{
Log.Add(LogTypes.Custom, 1, "test From my event" );
}
What do i do now, shall i reorder the XmlTree that is sendt to the method, or what do i have to do?
// Peter
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.