Sitefinity ASP.NET CMS - Content Management System

Support Forum Thread

Home >  Support >  Forums home > Sitefinity 3.x > Themes, Designs, Templates > Applying templates to pages

Reply
Rob, 7/22/2008 2:46:19 PM
Is there a way to apply a template/masterpage to all pages?
Reply
Joseph, 7/22/2008 6:29:56 PM
There is an easy way if you have access to the Sitefinity database.

sf_CmsPageContent: contains the page "variables" like MenuName, Title, etc.
sf_PageContentBase: contains the page template and versioning information.


UPDATE sf_PageContentBase SET MasterPage = '<Insert your template here>' 
 

WARNING: This will update all of the pages, you might want to first backup your database then place a where clause to restrict the changes.

Joseph Guadagno
Southeast Valley .NET User Group
Personal Site

Reply
, 7/25/2008 7:41:34 AM
Hi Guys,

Thanks for the help, Joe, your account has been updated.

This would work but there is a catch - the page templates also have records in the sf_PageContentBase table. The page templates have NULL values in the templateID column and this must be the same way after your code is executed. Their records should not be touched.

So in pseudo code the query would be something like:

In the sf_PageContentBase
For every record which has ItemType != "CmsTemplateContent"
Update MasterPage = "Your master page" and TemplateID = "Your template ID"


All the best,
Yasen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.