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

Forums / Designing with Sitefinity / Changing the masterpage used by a template

Changing the masterpage used by a template

4 posts, 0 answered
  1. Nicko
    Nicko avatar
    16 posts
    Registered:
    10 Mar 2008
    12 Aug 2008
    Link to this post
    Hi,

    We originally had two templates, using the same masterpage.
    Since then we have had to split this so we created two new masterpages, one for each template.

    As we already had a lot of pages using the original templates, we wrote a query to map the templates to the new masterpages in the database. To do this we found out the TemplateID of each template. Then ran an update to change to the new masterpage for each (In the sf_PageContentBase) table

    Similar to this article -
    http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-bkbdcd.aspx


    We found that we also had to update the sf_StagedPageContent table.

    When we click on a page via the pages module it still appears with the old original template/masterpage. Yet when you click to edit the page, it shows the new updated template/masterpage. Also when publishing (we are using workflow) or previewing the page it uses the original template.

    Is there another table or something were missing to be able to do this correctly?
  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    14 Aug 2008
    Link to this post
    Hello Nicko,

    As you have discovered, Sitefinity uses dependant tables for persisting data. We strongly discourage working directly with database when performing data work - and I would suggest you use our fully exposed API which will allow you to safely modify data without worrying about all the tables that need to be updated.

    You can find more about Pages/Controls/Templates API walkthrough at this location:
    http://www.sitefinity.com/help/developer-manual/working-with-pages-programmatically.html

    There are actually several topics, so make sure you browse these as well. In addition to being able to change templates, you will notice that API will allow you something that would be very hard to accomplish by simply modifying the database - namely you will have the control to replace a template with a new template which has completely different structure (you'd be working directly on the control level, mapping them from one container into another).

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    Sincerely yours,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Nicko
    Nicko avatar
    16 posts
    Registered:
    10 Mar 2008
    03 Sep 2008
    Link to this post
    Hi Ivan

    Sorry for the late reply. 

    I did a search of the forum and found the post I reffered to in my original post. That is what information I was going by and why I thought changing the database would result in what I was trying to achieve.

    I am not a developer so would not know how to use the API to achieve this. Is there another way a user would be able to do this? Seems like a common thing a user would do, how would you do it within Sitefinity?

    Cheers

    Nicko

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Sep 2008
    Link to this post
    Hi Nicko,

    Thank you for your question.

    Please escalate your request as a support ticket and we will take care of it. Please send us your database and master pages/ templates that you have created and provide us with more information about what you want to achieve. Does the whole project should use one new template, or some pages will use one template and the other pages will use the second template?

    We look forward to hearing from you.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered