Query to retrieve all template, web part, and widget level content

D D asked on October 19, 2016 17:41

Is there any way to query the database to retrieve all template, web part, widget content in xml format? I'm tasked in returning a list of all the pages and their HTML content in the CMS so we can look through the data and determine where we need to replace hard-coded HTML values with resource strings for localization purposes.

Currently I'm querying the CMS_VersionHistory table and the NodeXML field. What tables/views can I find what web parts and widget in? CMS_PageTemplate ? CMS_WebParts?

Correct Answer

Peter Mogilnitski answered on October 19, 2016 20:29

For web parts and page templates you can use

select CONVERT(XML,PageTemplateWebParts), * from cms_pageTemplate where PageTemplateWebParts like '%searchstring%'

I was checking that way to see if an old macro method has been removed from our site. PageTemplateWebParts - is the XML that you see on Web parts Tab in page template properties.

To see which pages are using this template you can do select * from View_CMS_Tree_Joined where NodeTemplateID = YourTemplateID

P.S. People can hardcode HTML also in ContentBefore and ContentAfter - so you have to check those properties as well, but they are also in the same PageTemplateWebParts XML. Anyway It all depends what web parts are in your template, for ex: if this is an editable text, then you have to dig even more deeper because the editable content is not in the PageTemplateWebParts XML.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Roman Hutnyk answered on October 19, 2016 20:22

DocumentContent field in CMS_Document table contains all the content you add on the Page tab.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.