Copied to clipboard

Flag this post as spam?

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


  • Nicolae Sebastian Laslo 12 posts 78 karma points
    Sep 02, 2009 @ 12:07
    Nicolae Sebastian Laslo
    0

    Get Document by it's path

     

    Hello,

    Is it possible to get a reference to a Document node based on it's path ?

    I have this scenario: I have created a mini-module and when I'm installing it on another umbraco solution, each node get different IDs and my code references some nodes based on their ID. So I'm trying to find a way to get a reference based on path nor the ID.

     

    Thanks in advanced

    Nicu

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 02, 2009 @ 12:35
    Dirk De Grave
    1

    Hi Nicolae,

    Referencing nodes based on their id is a real bad idea (and you've just found out why). I'd go with one of the following options:

    - Change your code to accept node id's as parameter, so you don't have to rely on hard coded id's. I'm not sure whether that's applicable in your specific situation

    - Create a package out of your local solution, include the nodes that you're referencing in your code and install package onto the other umbraco solution. (Be aware that it's still possible to have id clashes, so a check upfront in the db would'nt hurt)

     

    Cheers,

    /Dirk

     

     

  • Nicolae Sebastian Laslo 12 posts 78 karma points
    Sep 02, 2009 @ 12:45
    Nicolae Sebastian Laslo
    0

    Hi Dirk,

     

    Thanks for quick reply;

    I think using GUIDs instead of IDs to uniquelly identify "entities" in Umbraco will solve a lot af problems.

    I will try you suggestion

    Best

    Nicu

Please Sign in or register to post replies

Write your reply to:

Draft