Sitecore 7 - 具有搜索相对路径的多列表
Sitecore 7 - Multilist with search relative path
给定以下结构
Home
Storage
Article1
Article2
Article3
Products
Product
其中项目 product
有一个针对项目 storage
的 Multilist with search
字段。如何设置相对于产品的 StartSearchLocation?
我尝试了以下方法
StartSearchLocation=query:[parent::item[@@templatename=Home]]/Storage
您可以将以下内容添加到模板的 Source
字段中;
query:ancestor-or-self:: *[@@templatename = 'home']/*[@@templatename = 'storage']/*
这将查找模板为 Home 的祖先(或 iteself),然后查找具有存储模板的 home 的子项。然后它将 select 存储下的所有项目。
您甚至可以更进一步,确保只有 selects 存储的项目是文章;
query:ancestor-or-self:: *[@@templatename = 'home']/*[@@templatename = 'storage']/*[@@templatename = 'articles']
虽然我不建议使用 templatename
,但例如 Templateid
;
query:ancestor-or-self:: *[@@templateid = '{96563B8C-A000-488C-B7E2-96008C24F3D3}']/*[@@templateid = '{0E47CA9D-E762-4FDF-8C6C-C500DD9EB40A}']/*[@@templateid = '{0E47CA9D-E762-4FDF-8C6C-C500DD9EB40A}']
别忘了用你的
替换我的Guids
给定以下结构
Home
Storage
Article1
Article2
Article3
Products
Product
其中项目 product
有一个针对项目 storage
的 Multilist with search
字段。如何设置相对于产品的 StartSearchLocation?
我尝试了以下方法
StartSearchLocation=query:[parent::item[@@templatename=Home]]/Storage
您可以将以下内容添加到模板的 Source
字段中;
query:ancestor-or-self:: *[@@templatename = 'home']/*[@@templatename = 'storage']/*
这将查找模板为 Home 的祖先(或 iteself),然后查找具有存储模板的 home 的子项。然后它将 select 存储下的所有项目。
您甚至可以更进一步,确保只有 selects 存储的项目是文章;
query:ancestor-or-self:: *[@@templatename = 'home']/*[@@templatename = 'storage']/*[@@templatename = 'articles']
虽然我不建议使用 templatename
,但例如 Templateid
;
query:ancestor-or-self:: *[@@templateid = '{96563B8C-A000-488C-B7E2-96008C24F3D3}']/*[@@templateid = '{0E47CA9D-E762-4FDF-8C6C-C500DD9EB40A}']/*[@@templateid = '{0E47CA9D-E762-4FDF-8C6C-C500DD9EB40A}']
别忘了用你的
替换我的Guids