Getting individual tags from getAllTagsInGroup('abc')
Hi,
I'm working on a 4.0.2.1 installation, and am trying to build a string in a Base method using getAllTagsInGroup. The code I have is this:
var tags = umbraco.editorControls.tags.library.getAllTagsInGroup("document downloads"); foreach (var tag in tags) { debugString += tag.ToString().ToLower() + " <br /> "; }
When I output 'debugString' it outputs ALL tags in the group for each iteration. So it loops through all 50+ tags in the group, but outputs all of the tags each time, so I end up with 50 identical lines of text - each made up of all the tags in the group joined together.
I think this is something to do with umbraco.editorControls.tags.library.getAllTagsInGroup returning the full XML for the tags, rather than an array of tags as I'd thought it would.
Does anyone know where the tags XML is stored, or are tags not stored in their own XML file and just pulled directly from the database in the Umbraco UI, then saved in the umbraco.config XML file? Does anyone know how to get the individual tags out of the 'tags' variable above?
Getting individual tags from getAllTagsInGroup('abc')
Hi,
I'm working on a 4.0.2.1 installation, and am trying to build a string in a Base method using getAllTagsInGroup. The code I have is this:
When I output 'debugString' it outputs ALL tags in the group for each iteration. So it loops through all 50+ tags in the group, but outputs all of the tags each time, so I end up with 50 identical lines of text - each made up of all the tags in the group joined together.
Can anyone see how to correct this?
Thanks
I think this is something to do with umbraco.editorControls.tags.library.getAllTagsInGroup returning the full XML for the tags, rather than an array of tags as I'd thought it would.
Does anyone know where the tags XML is stored, or are tags not stored in their own XML file and just pulled directly from the database in the Umbraco UI, then saved in the umbraco.config XML file? Does anyone know how to get the individual tags out of the 'tags' variable above?
Okay, after a bit of digging I found some documentation which describes the 'getAllTagsInGroup' method.
So how do I deal with a data type of XPathNodeIterator type in order to iterate through the nodes?
I know it's possible to do this:
But when I replace XPathDocument("file.xml") with XPathDocument(tags) it errors:
Any ideas very much appreciated folks!
Got it!
is working on a reply...