I just started using Umbraco a couple of days ago and at least one of those days was simply getting it running correctly on Azure (and playing with v6 vs. v7).
I've settled on v7 and I'm using Mvc with Razor syntax.
Now, I'm probably missing something very simple here, but it seems to me like the Document Type/Template structure is a bit redundant when it comes to filling out property information (when it comes to actually filling out content).
If I have a simple site like this:
Home
-> About
-> Contact Us
There's some content that I only want to place once (like a banner image, or footer text) that is repeated across all pages. What is the proper way to lay out the doc types and templates so that "Home" is the only place where those fields are populated.
The only solution I've found is to use the Parent/Child relationships between About and Home and get the parent node when I'm on About, and then GetProperty("whatever").Value... This works for something like footer text, but I don't want to have to do that every single time I need to get a property that is defined on the document type for the home page. Is there a better way?
It does not matter if you use 6 or 7 with this problem. Please try the following code - replacing 1000 and "aliasOfProperty" with the relevant values):
var result = new DynamicNode(1000).GetPropertyValue("aliasOfProperty", true);
For things like banner images you can use recursive properties so Umbraco will look up the tree to the nearest parent node with the property filled out if one hasn't been selected on that node. That way you can have a benner for the site, override it for a section if you want, and override it for an actual node.
Best practices to reduce property redundancy
I just started using Umbraco a couple of days ago and at least one of those days was simply getting it running correctly on Azure (and playing with v6 vs. v7).
I've settled on v7 and I'm using Mvc with Razor syntax.
Now, I'm probably missing something very simple here, but it seems to me like the Document Type/Template structure is a bit redundant when it comes to filling out property information (when it comes to actually filling out content).
If I have a simple site like this:
Home
-> About
-> Contact Us
There's some content that I only want to place once (like a banner image, or footer text) that is repeated across all pages. What is the proper way to lay out the doc types and templates so that "Home" is the only place where those fields are populated.
The only solution I've found is to use the Parent/Child relationships between About and Home and get the parent node when I'm on About, and then GetProperty("whatever").Value... This works for something like footer text, but I don't want to have to do that every single time I need to get a property that is defined on the document type for the home page. Is there a better way?
Hi there,
It does not matter if you use 6 or 7 with this problem. Please try the following code - replacing 1000 and "aliasOfProperty" with the relevant values):
Hi what you are asking for is doc type inheritence.
In your doc type properties they get inherited from the top down
(doctype) Home > (doctype) About Us
Anything defined on Home will get inherited by About Us
Make sense?
Charlie :)
For things like banner images you can use recursive properties so Umbraco will look up the tree to the nearest parent node with the property filled out if one hasn't been selected on that node. That way you can have a benner for the site, override it for a section if you want, and override it for an actual node.
is working on a reply...