Copied to clipboard

Flag this post as spam?

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


  • Alexandru Rustin 7 posts 87 karma points
    Feb 15, 2021 @ 17:50
    Alexandru Rustin
    0

    Umbraco V7 -> V8 changes - looking for equivalent methods / documentation

    Hello everyone.

    I've inherited an umbraco project (meaning, not much experience with it), I'm working on migrating from v7 to v8.11 and I'm stuck with the changes regarding the nodes.

    var slidesNode = Node.GetCurrent().GetChildNodeByName(model.HomepageSlidesNodeName);
    
    var content = Umbraco.TypedContent(Node.getCurrentNodeId());
    

    Can anyone please point me to some documentation about getting the current node and how to work with nodess in version 8?

    The only thing I've found is a few words in Umbraco helper - Working with Content.

    Thank you,

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Feb 15, 2021 @ 18:30
    Paul Wright (suedeapple)
    0

    Moving from v7 to v8 - can be a difficult challenge. Especially, if the site uses a lot of custom datatypes, which dont have a v8 equivilant.

    Ask yourself "WHY" you need to be on v8. Is there some technology you need to harness? or is it merely a "hobby challenge"?

    If you are "New to Umbraco" - I would suggest learning more about how v7 works, and the ModelsBuilder, and how to Query the Tree node structure.

    Good Luck!

  • Alexandru Rustin 7 posts 87 karma points
    Feb 16, 2021 @ 07:22
    Alexandru Rustin
    0

    The why is quite simple, I'm the only one in the team that has even touched Umbraco and upgraded DNN to the latest version and boom, I'm the upgrade guy :)

  • Alex Skrypnyk 6131 posts 23950 karma points MVP 7x admin c-trib
    Feb 15, 2021 @ 19:23
    Alex Skrypnyk
    100

    Hi Alexandru

    It's easy, this is a first line:

        var slidesNode = Umbraco.AssignedContentItem.Children.FirstOrDefault(x => x.Name.Equals(model.HomepageSlidesNodeName));
    

    And this is a second line:

    var content = Umbraco.AssignedContentItem;
    

    In the first line, I would not recommend you using node name for retrieving the content, if somebody changes the name in the backend this logic will not work. Use Id or doctypeAlias for this logic or content picker on a root node.

    Thanks,

    Alex

  • Alexandru Rustin 7 posts 87 karma points
    Feb 16, 2021 @ 07:34
    Alexandru Rustin
    0

    Hi Alex,

    Thank you for your response.

    I've just noticed the answer was right there under my eyes in the documentation. Looks like I need glasses.

    I understand the suggestion, makes sense, will look into it after I get it all up and running!

Please Sign in or register to post replies

Write your reply to:

Draft