Let's say that you want to access a field named "CompanyName" which you want to use anywhere, you can create either:
Create a property on your home node named "CompanyName" and then in your templates/macros use 'recursion' to access this fields value, this will basically looks up the content tree until it finds a field named "CompanyName" which is not empty.
The other way is to grab the value directly, this is for when you've set up a node outside of your website, for example "Config_Site", you can grab this in XSLT via a variety of ways, one being using the ID of the node, see example here http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid
The other way is to grab the value using it's DocType, to do this you need to grab the Root of the site and look down the content tree for the specific Doc Type, you don't mention which version of Umbraco you are using so I can't offer a specific example for this.
Global Field for a site..
Hi,
I've read this post ( http://our.umbraco.org/forum/using/ui-questions/6984-Global-page-fields ), but if I want create a particular node ( say Config_Site with setup fields ), How Can I refer that fields from other web site pages?
For Example: into Master Page we have footer field, logo field and so, but If I go in a child field , I don't see their content.
Thank you
Hi,
You can do this in (at least) two different ways.
Let's say that you want to access a field named "CompanyName" which you want to use anywhere, you can create either:
Create a property on your home node named "CompanyName" and then in your templates/macros use 'recursion' to access this fields value, this will basically looks up the content tree until it finds a field named "CompanyName" which is not empty.
The other way is to grab the value directly, this is for when you've set up a node outside of your website, for example "Config_Site", you can grab this in XSLT via a variety of ways, one being using the ID of the node, see example here http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid
The other way is to grab the value using it's DocType, to do this you need to grab the Root of the site and look down the content tree for the specific Doc Type, you don't mention which version of Umbraco you are using so I can't offer a specific example for this.
Hope that makes sense and gives you some ideas.
Cheers
Rich
Thanks for your reply. Version is 4.5.2
Is it possible by Name ( GetXmlNodeById not by ID , because I'm on devel machine, now )?
is working on a reply...