Need NodeID's to be the same on both dev site and live site...
Hello,
I am in a giant time crunch to get a site up and running and I'm having a bit of a problem.
I have a macro that finds a node by its ID and loops through its children. When I deployed the site to live I noticed that all my content node ID's are different on the live site, rendered my code useless.
Obviously I'd like to find a better way to write this piece of code, but it's taking me too long to figure out and I really need a quick fix. Is there any way to ensure that the content node ID's on your live site match the ID's on your dev site?
One way is to backup the entire database and overwrite the production database. Of course, that wipes out any data specific to your production environment.
Alternatively, you can create a configuration file (or use app settings in your web.config) to store the node ID's. That way, each environment can use different node ID's.
Another way would be to have a settings node (or nodes) in Umbraco that has content pickers that allow you to choose nodes by their ID's.
By the way, how did you deploy to your live site? If you used Courier, the node ID's would be different, but the node GUID's (aka, keys) would be identical. If you can use the GUID's rather than the integer ID's, that could be a workable solution.
I deployed the site via Courier. I actually have a separate problem where the other method of deployment (from the main umbraco page) didn't work for me. So I used Courier instead.
I'm very new to Umbraco and Razor, so I'm not sure how I would go about using GUID's instead of node IDs. Here is my code... any help on this would be so much appreciated!
Need NodeID's to be the same on both dev site and live site...
Hello,
I am in a giant time crunch to get a site up and running and I'm having a bit of a problem.
I have a macro that finds a node by its ID and loops through its children. When I deployed the site to live I noticed that all my content node ID's are different on the live site, rendered my code useless.
Obviously I'd like to find a better way to write this piece of code, but it's taking me too long to figure out and I really need a quick fix. Is there any way to ensure that the content node ID's on your live site match the ID's on your dev site?
Thanks in advance!
One way is to backup the entire database and overwrite the production database. Of course, that wipes out any data specific to your production environment.
Alternatively, you can create a configuration file (or use app settings in your web.config) to store the node ID's. That way, each environment can use different node ID's.
Another way would be to have a settings node (or nodes) in Umbraco that has content pickers that allow you to choose nodes by their ID's.
By the way, how did you deploy to your live site? If you used Courier, the node ID's would be different, but the node GUID's (aka, keys) would be identical. If you can use the GUID's rather than the integer ID's, that could be a workable solution.
Thanks your your replies Nicholas,
I deployed the site via Courier. I actually have a separate problem where the other method of deployment (from the main umbraco page) didn't work for me. So I used Courier instead.
I'm very new to Umbraco and Razor, so I'm not sure how I would go about using GUID's instead of node IDs. Here is my code... any help on this would be so much appreciated!
@Traverse("1072")
@Traverse("1087") @Traverse("1114")
@Traverse("1131")
@Traverse("1154")
@helper Traverse(string nodeID) { var node = Umbraco.Content(nodeID);
is working on a reply...