xpath 빌더를 사용하는 시작 키트에서 홈 항목 아래의 '사이트 섹션'템플릿에서 상속 한 모든 항목을 얻는 방법은 무엇입니까?sitecore 쿼리를 사용하여 항목 검색
나는 다음과 실행하면 :
/sitecore/content/home/*[@@templatekey='site section']
가 난 할 노력하고있어 것은 :
/sitecore/content/home/*[@@templatekey='product section']
하나의 항목이 의미가 /sitecore/content/Home/Products
을 반환하지만, 다음 아무것도 반환하지 않습니다 xslt 대신 asp.net 웹 컨트롤을 사용하여 'Site Section'템플릿을 상속하는 항목에서 메뉴를 빌드하십시오.
아이디어가 있으십니까?
감사합니다, 타렉
**
질문에 대한 추가 정보를 제공 UPDATE :
항목 /sitecore/content/Home/Products
는 경우 /sitecore/templates/Starter Kit/Item Types/Site Section
의 기본 템플릿을 가지고 템플릿 /sitecore/templates/Starter Kit/Site Sections/Product Section
을 가지고 I 집에서 제품 및 참조 (제품과 유사) 항목을 원한다면 다음 쿼리를 실행합니다. :
/sitecore/content/home/*[@@templatekey='product section' or @@templatekey='references section']
사이트 섹션이 기본 서식 파일 인 홈 아래에서 항목을 가져 오는 방법이 있습니까? xslt에는이를 수행하는 sc:GetItemsOfType('site section',$home/item)
메소드가 있습니다.
** 대답 나는 당신이 할 제안 무엇
var homeItem = Sitecore.Context.Database.GetItem(Sitecore.Context.Site.StartPath);
var siteSectionItems = new List<Item>();
foreach (Item item in homeItem.Children)
{
var itemTemplate = TemplateManager.GetTemplate(item);
if (itemTemplate.InheritsFrom("Site Section"))
siteSectionItems.Add(item);
}
덕분에, 세부 사항을 주셔서 감사합니다,하지만 코드는 쿼리를 실행하는 것과 동일합니다 :/sitecore/내용/홈/* [@@ templatekey = '제품 섹션'] 그것은 최대 따기 아니에요을 사이트 섹션이어야하는 제품 섹션의 기본 템플릿. –