SDL Tridion中的关键字路径 [英] Keyword Path in SDL Tridion

查看:107
本文介绍了SDL Tridion中的关键字路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以提出一些想法吗?这可能非常简单和基本,但是我无法弄清楚.

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.

这是我的要求.

我的类别A的子关键字为B,而B的关键字为C.

I have a category A with child keyword B and B got another Child Keyword C.

我想在我的组件模板中获取所选关键字的确切路径,例如,如果用户选择关键字C,则我需要具有A \ B \ C之类的值,而不仅仅是C.但是Tridion总是给出我的值是C而不是A \ B \ 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.

我应该编写Dreamweaver自定义函数来解决这个问题吗?还是tridion附带了一些处理程序?

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!

谢谢, KK

推荐答案

您刚刚发现,Tridion关键字层次结构是伪造的"-关键字存储为平面列表,而不是层次结构列表(就像您将与文件夹).有关parent和child关键字的信息存储在关键字本身中.

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.

有一些解决方案-当然,例如,您可以在C#TBB中使用它:

There are solutions for this - of course, for instance you can use this in a C# TBB:

Keyword keyword = new Keyword(new TcmUri("tcm:28-3368-1024"), session);
string hierarchy = keyword.Title;
bool done = false;
while(!done)
{
    if (keyword.ParentKeywords.Count > 0)
    {
        foreach (Keyword k in keyword.ParentKeywords)
        {
            hierarchy = k.Title + " > " + hierarchy;
        }
        keyword = keyword.ParentKeywords[0];
    }
    else
        done = true;
}
// Include Category
hierarchy = keyword.OrganizationalItem.Title + " > " + hierarchy;

已更新,以递归方式遍历"层次结构.但是,一个关键字可以有多个父级,我让您自己解决...

Updated to recursively "go up" the hierarchy. HOWEVER a keyword can have multiple parents, I'll leave that up to you to fix...

这篇关于SDL Tridion中的关键字路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆