Could someone please give some idea on how this can be done? This might be very simple and basics, but i couldn't figure this out.
Here is my requirement.
I have a category A with child keyword B and B got another Child Keyword C.
I want to get the exact path of selected keyword in my component template,Say for eg, if user selects keyword C, i need the value with path like A\B\C and not just as C. But Tridion always gives me the value as C and not as A\B\C . Component Schema is using "Tree" view to select the keywords.
Should I be writing dreamweaver custom functions to handle this? Or does tridion comes with some handler for this?
Any help would be highly appreciated. Thank you!
Thanks, KK
As you just found out, the Tridion Keyword Hierarchy is "fake" - Keywords are stored as a flat list, not as a hierarchical list (like you would have with folders). The information about the parent and children keywords is stored in the keyword itself.
There are solutions for this - of course, for instance you can use this in a C# TBB:
EDIT: Updated to recursively "go up" the hierarchy. HOWEVER a keyword can have multiple parents, I'll leave that up to you to fix...
Keywords within a category are unique, so Tridion can safely refer to them by their name (and/or their TCM URI of course). And since a Keyword can have multiple parents, there may not be a single path leading from the root to your Keyword.
If in your situation the category can be represented as a tree, you can of course build a single path to each keyword. In that case you'll need some (C#) code that walks up the parents axis and concatenates the names. You can put this code either:
Either way will work fine.