2016-07-14 3 views
0

devx가 ascx 파일을 30 개 작성하고 webpart로 등록한 사이트가 있습니다. 나는 Kentico 데이터베이스를 질의하여 사이트에 어떤 사이트가 있는지 알아보고 웹 파트를 파일 이름과 연관 짓고 싶습니다. 즉, 활성 페이지와 ascx 파일을 연관시키는 쿼리를 실행합니다. 내가 할Kentico 7 DB 사용하지 않는 CMSWebpart를 찾으십시오

하나 개의 쿼리가 나를 보여줍니다이 테이블에 포함 된 XML의 :

이 GUID는 데이터베이스에 저장됩니다

? 나는 여기서 협회를 잃어 버렸고, 그것은 나에게 열매를 맺고있다. 각 활성 페이지에 해당하는 웹 ascx 파일을 CMS Desk에서 확인할 수 없습니다.

답변

2

다음 쿼리를 사용할 수 있습니다. WebPart ASCX 파일의 실제 위치에 대한 경로, 웹 파트가있는 페이지 서식 파일의 코드 이름은 물론 사용되는 페이지의 NodeAliasPath 경로를 나열합니다. 선택한 열을 원하는대로 조정할 수 있습니다.

SELECT DISTINCT 
    WP.WebPartFileName,  -- Physical location of the webpart file 
    NodeAliasPath,   -- Alias path of the page that uses the webpart 
    PageTemplateCodeName -- Code name of the template that contains the webpart 
FROM CMS_WebPart WP 
INNER JOIN 
(
    -- Convert the PageTemplateWebParts column to XML 
    -- Get the 'type' attribute from all 'webpart' elements, as the 'WebPartName' column 
    SELECT 
     PageTemplateID, 
     PageTemplateCodeName, 
     T.N.value('@type', 'varchar(50)') as WebPartName 
    FROM CMS_PageTemplate 
    CROSS APPLY (SELECT CAST(PageTemplateWebParts AS XML)) as X(X) 
    CROSS APPLY X.X.nodes('/page/*/webpart') T(N) 
) TemplateWebParts ON WP.WebPartName = TemplateWebParts.WebPartName 
-- Join the Tree view, to get NodeAliasPaths of pages that use the template 
INNER JOIN View_CMS_Tree_Joined T ON T.NodeTemplateID = TemplateWebParts.PageTemplateID 
ORDER BY NodeAliasPath 

Kentico에서 WebParts는 페이지 템플리트에 있으며이 템플리트는 페이지와 연관됩니다. PageTemplateWebParts 열에는 해당 설정과 함께 XML로 표시됩니다.

webpart 요소의 type 속성은 테이블의 WebPartName 열과 같습니다.

관련 문제