Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • pnr 131 posts 226 karma points
    Oct 28, 2009 @ 12:42
    pnr
    0

    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

  • Aaron Powell 1708 posts 3044 karma points c-trib
    Oct 28, 2009 @ 12:45
    Aaron Powell
    0

    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.

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Oct 28, 2009 @ 12:45
    Peter Dijksterhuis
    0

    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

  • pnr 131 posts 226 karma points
    Oct 28, 2009 @ 13:33
    pnr
    0

    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!

  • Aaron Powell 1708 posts 3044 karma points c-trib
    Oct 28, 2009 @ 22:26
    Aaron Powell
    0

    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.

  • pnr 131 posts 226 karma points
    Oct 29, 2009 @ 09:05
    pnr
    0

    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!

     

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Oct 29, 2009 @ 09:24
    Dirk De Grave
    0

    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

  • pnr 131 posts 226 karma points
    Oct 29, 2009 @ 11:05
    pnr
    0

    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

  • 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.

Please Sign in or register to post replies