2016-07-14 11 views
0

devxがascxファイルのコピーを30個作成し、webpartとして登録したサイトがあります。私はKenticoのデータベースに問い合わせて、サイト上にどのサイトが生存しているかを知り、Webパーツをファイル名に関連付けることができるようにしたいと考えています。つまり、ascxファイルをアクティブなページに関連付けるためのクエリを実行します。私はKentico 7 DB未使用のCMSWebpartを見つけよう

つのクエリは、テーブルに埋め込まれたXMLに私にこのことを示しています。このGUIDはデータベースに格納され

?私はここで協会を逃していると私はナットを運転しています。私はCMSのデスクからどのウェブのascxファイルが各アクティブなページに対応しているのかを判断することはできません。

答えて

2

次のクエリを使用できます。 WebPart ASCXファイルの物理的な場所、使用されているページのNodeAliasPath、WebPartが配置されているページテンプレートのコード名のパスを一覧表示します。選択した列を好みに合わせて微調整できます。

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属性は、CMS_WebPart表のWebPartName列に相当します。

関連する問題