i have a number of dictionary items but i can't figure out a way of using them within text. for example if someone is using a rich text editor or a text field on the admin side, is there a way for them to enter something that will use a keyword that gets translated into the dictionary item on the front end?
does anyone have any ideas about this? im sure im not the only person to think about this as an option?
i tried to override some of the rendering functions in umbraco but i think i was over my head there. i wanted to enter a setting that would serach for something like ##dictionaryitemname## and use that to search the dictionary
If you need to use dictionary items in a rich text editor you will need to create a macro (based on either, xslt, razor or a user control) and in this code you need to refer the dictionary items that you have created in the dictionary folder in the settings section.
actually, i think i am going to do it a completely different way than i explained, but basically the same as what you said first.
it seems to work so far, i made a macro to write out the fields themselves individually (like how we use umbraco:item in the template to write out a text field or rich text editor content) but before it finishes writing out, it does a find replace for all the dictionary items that i have put in. that seems to work, it only took me about a month to come up with, lucky too because i need to finish this today :D clutch!
here is my c# code for anyone that is interested. just plug this in appropriately and create the macro and just replace the correct fields :)
ReplaceItems.getDictionaryItem is a function that just replaces all individual items from the dictionary. it doesn't look through all the dictionary items automatically, i had to manually add them in since there were only like 5. anyone want to make that function automatic feel free to add your function here as well.
public string field = ""; public string insertbefore = ""; public string insertafter = ""; public string Field { get{return field;} set{field = value;} } public string InsertBefore { get{ return insertbefore;} set{insertbefore = value;} } public string InsertAfter { get{return insertafter;} set{insertafter = value;} } protected void Page_Load(object sender, EventArgs e) { Node curNode = Node.GetCurrent(); string returnstring = Convert.ToString(curNode.Properties[field].Value); if (!String.IsNullOrEmpty(returnstring)) { literalReturned.Text = insertbefore + ReplaceItems.getDictionaryItem(returnstring) + insertafter; } }
Dictionary items in fields
i have a number of dictionary items but i can't figure out a way of using them within text. for example if someone is using a rich text editor or a text field on the admin side, is there a way for them to enter something that will use a keyword that gets translated into the dictionary item on the front end?
does anyone have any ideas about this? im sure im not the only person to think about this as an option?
i tried to override some of the rendering functions in umbraco but i think i was over my head there. i wanted to enter a setting that would serach for something like ##dictionaryitemname## and use that to search the dictionary
Hi mfeola
If you need to use dictionary items in a rich text editor you will need to create a macro (based on either, xslt, razor or a user control) and in this code you need to refer the dictionary items that you have created in the dictionary folder in the settings section.
Could you describe what you're trying to achieve?
Looking foward to hear more from you.
/Jan
actually, i think i am going to do it a completely different way than i explained, but basically the same as what you said first.
it seems to work so far, i made a macro to write out the fields themselves individually (like how we use umbraco:item in the template to write out a text field or rich text editor content) but before it finishes writing out, it does a find replace for all the dictionary items that i have put in. that seems to work, it only took me about a month to come up with, lucky too because i need to finish this today :D clutch!
here is my c# code for anyone that is interested. just plug this in appropriately and create the macro and just replace the correct fields :)
ReplaceItems.getDictionaryItem is a function that just replaces all individual items from the dictionary. it doesn't look through all the dictionary items automatically, i had to manually add them in since there were only like 5. anyone want to make that function automatic feel free to add your function here as well.
is working on a reply...