Is there a way of having global terms in Umbraco? For instance if I want to say we have 20 branches nationwide I want the 20 to be a global term that can be changed.
I tried using a macro and some script to simply put the number in, but this annoyingly puts a line break above and below so I end with something like:
In fact it splits the text, if it was in a paragraph tag, it closes it and re-opens it after the macro div, surely there must be another way, I am hoping this one small thing that is required will not stop me from using it?
Also I think this forum is broken, I can't edit my post.
Hi. If I understand your question right you want to have something like a 'global setting' for your portal that can be easyly changed by a portal editor/administrator. If that's true there're two common approaches that I'm aware of:
1) You can introduce a special document type dedicated completely to store your settings as fields. Then you put a document of this type to some fixed place in your content tree and when you need to get some setting you can extract it with API from this document.
2) Also as another option you can introduce a special document type for your home page and store your settings in it. There're advantages in this approach since in practice these 'global variables' often used on all pages and it's often convenient to get them with a 'recursive' option of a <umbraco:Field> control.
The issue is not the storing, there are several ways of doing that, it's the displaying of the value inline as apposed to using a plugin/macro that splits the lines, a bit like the shortcodes package which would be ideal except I can't see any way of the editor of the pages adding their own.
you could do it using the dictionary only thing is you would only be able to use it in a template unless you create a macro for it that it can be used in rich text edit.
Is ther soem reason why you wouldnt include the whole section with your macro fro example
"we have Yourvariable branches"
to prevent the behavior you are experiencing or as Rodion suggested using <umbraco:field> control within the template of the page that displays the value
Afaik, there used to be some problems with displaying macros as inline elements in content in the older versions of umbraco, but they are fixed in the recent once. While editing the content the editor control shows a macro as a block DIV element (unfortunately it's by design), but on a live page it's going to be drawn as-is without a wrapping div. So if you use the version of umbraco at least not older than 4.7 there shouldn't be a problem with it.
Like Rodion said there is the problem with the DIV, so therefore it will always be on a seperate line and still not flow, it makes it too restrictive as well as I would have to write a seperate thing for each variation of how I wanted to display the information.
Global terms
Is there a way of having global terms in Umbraco? For instance if I want to say we have 20 branches nationwide I want the 20 to be a global term that can be changed.
I tried using a macro and some script to simply put the number in, but this annoyingly puts a line break above and below so I end with something like:
We have
20
branches nationwide
In fact it splits the text, if it was in a paragraph tag, it closes it and re-opens it after the macro div, surely there must be another way, I am hoping this one small thing that is required will not stop me from using it?
Also I think this forum is broken, I can't edit my post.
Hi. If I understand your question right you want to have something like a 'global setting' for your portal that can be easyly changed by a portal editor/administrator. If that's true there're two common approaches that I'm aware of:
1) You can introduce a special document type dedicated completely to store your settings as fields. Then you put a document of this type to some fixed place in your content tree and when you need to get some setting you can extract it with API from this document.
2) Also as another option you can introduce a special document type for your home page and store your settings in it. There're advantages in this approach since in practice these 'global variables' often used on all pages and it's often convenient to get them with a 'recursive' option of a <umbraco:Field> control.
The issue is not the storing, there are several ways of doing that, it's the displaying of the value inline as apposed to using a plugin/macro that splits the lines, a bit like the shortcodes package which would be ideal except I can't see any way of the editor of the pages adding their own.
you could do it using the dictionary only thing is you would only be able to use it in a template unless you create a macro for it that it can be used in rich text edit.
Is ther soem reason why you wouldnt include the whole section with your macro fro example
"we have Yourvariable branches"
to prevent the behavior you are experiencing or as Rodion suggested using <umbraco:field> control within the template of the page that displays the value
Afaik, there used to be some problems with displaying macros as inline elements in content in the older versions of umbraco, but they are fixed in the recent once. While editing the content the editor control shows a macro as a block DIV element (unfortunately it's by design), but on a live page it's going to be drawn as-is without a wrapping div. So if you use the version of umbraco at least not older than 4.7 there shouldn't be a problem with it.
Like Rodion said there is the problem with the DIV, so therefore it will always be on a seperate line and still not flow, it makes it too restrictive as well as I would have to write a seperate thing for each variation of how I wanted to display the information.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.