Using Umbraco version 7.5.4, I've created a separate Global settings node outside of the main structure see image below, which just contains global info for the site. When I add the corresponding Umbraco field within my page templates the info doesn't render, any clue where I am going wrong.
As always much appreciated in with any help.
Global settings node
Hi,
Using Umbraco version 7.5.4, I've created a separate Global settings node outside of the main structure see image below, which just contains global info for the site. When I add the corresponding Umbraco field within my page templates the info doesn't render, any clue where I am going wrong. As always much appreciated in with any help.
Kind regards
Nick
Hi,
i would guess it because you are not finding the global settings node before you ask for the values.
in your template you will first need to find the global settings node ?
something like :
might work . assuming your global site settings node doctype is called globalSettings
i usually put something this in a helper class, then you can call it without doing the lookup.*
e.g.
would (when namespace is included in the razor) let you do something like:
* error checking not included
Hi Kevin,
nice tip about using an extension on the UmbracoHelper class for returning a root node!
Thanks!
/Michaël
Kevin,
Thanks for this helper class.
Needed to change a few things, but then it worked great...
BTW ... the changes I made:
changed backward slashes to forward slashes => ("//globalSettings");
added round brackets to GlobalSettings => @Umbraco.GlobalSettings().GetPropertyValue("twitterUrl")
Thanks for your help, your solution worked great.
Cheers
Nick
Thanks for posting this. I need to the same thing!
is working on a reply...