+1-888-365-2779
Try Now
More in this section

Forums / Designing with Sitefinity / Applying templates to pages

Applying templates to pages

3 posts, 0 answered
  1. Rob
    Rob avatar
    2 posts
    Registered:
    05 Feb 2008
    22 Jul 2008
    Link to this post
    Is there a way to apply a template/masterpage to all pages?
  2. Joe
    Joe avatar
    64 posts
    Registered:
    05 Jul 2012
    22 Jul 2008
    Link to this post
    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
  3. Yasen
    Yasen avatar
    121 posts
    Registered:
    18 May 2013
    25 Jul 2008
    Link to this post
    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.
Register for webinar
3 posts, 0 answered