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

Forums / Designing with Sitefinity / Editing Master Pages

Editing Master Pages

16 posts, 0 answered
  1. Frank
    Frank avatar
    25 posts
    Registered:
    14 Jul 2008
    14 Oct 2008
    Link to this post
    Is there a way to edit a master page so that the change immediately shows up in its associate template? Or do you have to create a new template every time you have to change a master page? I don't like the idea of having to go through lots of pages and having to change the template it's using just because I made a minor change to a master page.
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    14 Oct 2008
    Link to this post
    as far as I know, you can edit a master page directly by ftping it down then uploading your changes. I do this all the time for example I added the google analytics to the footer of my master page.

    however if you make changes to your content placeholders, such as remove or rename the ones being used by sitefinity, the content in them will no longer be visible.
  3. Frank
    Frank avatar
    25 posts
    Registered:
    14 Jul 2008
    14 Oct 2008
    Link to this post
    Yes, but will updating the master page affect the template or do I have to create a whole new template. My concern is that I am going to have a template that many pages use and I am going to need to make a change that will require me to create a new template and than go to each page and tell it to use the new template. I'm trying to avoid that.
  4. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    14 Oct 2008
    Link to this post
    oh if you mean REPLACE a template, then i believe you would have to individually set each page to use the new one. for example if you have templateA and create a new templateB then each page in templateA would have to be moved to templateB.

    However, if you EDIT templateA and reupload templateA OVERWRITING the original file of templateA, then all associated pages will receive the update, as they are dynamically loaded into the template at run time.

    hope that this was helpful
  5. Brent
    Brent avatar
    4 posts
    Registered:
    24 Oct 2007
    03 Nov 2008
    Link to this post
    I'm still unclear as to the flow there. If I upload MasterPage1 and create TemplateA with it, then go back and edit and reupload the MasterPage with the same name, will those changes be reflected in TemplateA, and thusly reflect in all the pages that inherit from TemplateA?
  6. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    03 Nov 2008
    Link to this post
    Hello Brent,

    Yes, when you change the master page, the changes will be applied to all templates that are using the .master file and all pages that are using those templates. The Sitefinity page template does not actually represent the master page, it has a relation to it:

    Master Page -> Template -> Page
         
    Please let us know if there is still something unclear to you.

    Greetings,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Chris
    Chris avatar
    8 posts
    Registered:
    07 Oct 2008
    18 Nov 2008
    Link to this post
    This doesn't seem to work at all in 3.5 SP1.
    Once I have uploaded a master page and generated the template it cna never be modified.
    How exactly do you make a change to a template?
    I don't like the idea of having to delete and recreate it since I will have to enter all my css and javascript references again.
    From what I can see Frank's original question hasn't been answered, and I have the same question.
    With things seemingly not working, is it the case that a simple change to a template potentially requires a tedious update to every page in the site?

    Thanks,
    Chris.
  8. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    20 Nov 2008
    Link to this post
    Hello Chris,

    I just tested the scenario again, and everything is working as expected. Here is what steps I followed:

    1. Created a blank project.
    2. Created a new page with the Default template.
    3. Opened the page in a new browser window (let's call it BrowserWindow).
    4. Edited the Default.master located in App_Master directory.
    5. Refreshed the page in BrowserWindow

    The change I applied in step 4 was reflected to the page in the BrowserWindow.

    Please note that you can also change the template. Just go to Pages -> Templates and change the template in the way you want.

    Let me know if I am missing something.

    Greetings,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. Michael
    Michael avatar
    17 posts
    Registered:
    12 Oct 2008
    26 Jan 2009
    Link to this post
    Yes, something seems to be missing from this example.  I have modified my master page (by adding a new content placeholder) and this content placeholder is not visible in the "edit template" UI in sitefinity.

    I am guessing that changes to HTML are propagated, but adding (and possibly removing) content placeholders are not.

    I tried uploading the .master page again (giving the template the same name as my original template) and this does not seem to work.

    In addition, both before and after uploading my modified .master I get this error when going to "edit template" and then clicking "save" or "cancel":
     <br>
    <span></span><h2><i><i>A template with the same name already exists.</i></i></h2><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><pre>[ArgumentException: A template with the same name already exists.]<br> Telerik.Cms.Data.PageTemplate.CheckNames() +495<br> Telerik.Cms.Data.PageTemplate.VerifyObject() +38<br> Nolics.ORMapper.Base.OdbClassHelper.VerifyClass(IOdbClass cl) +58<br> Telerik.Cms.Data.PageBase.Nolics.ORMapper.Base.IOdbClass.BeginCommit() +28<br> Nolics.ORMapper.Base.Transaction.Commit(Boolean fCleanIfSuccess) +1419<br> Nolics.ORMapper.Base.Transaction.Commit() +33<br> Telerik.Cms.Data.StagedPage.Publish() +637<br> Telerik.Cms.Data.StagedPage.CheckIn() +417<br> Telerik.Cms.Web.UI.ToolBar.Button_Command(Object sender, CommandEventArgs e) +231<br> System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +108<br> System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135<br> System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10<br> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13<br> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175<br> System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565<br></pre></font>
    
    



  10. Brent
    Brent avatar
    4 posts
    Registered:
    24 Oct 2007
    26 Jan 2009
    Link to this post
    It is definity true that if you modify the .master page the template changes immediately. I have probably done this ~500 times and it works.

    Remember that when you edit the master page the template changes, but you still have to edit the template if you want anything *in* that placeholder. Typically I pull out a section of my comp that I want to be dynamic, replace it with an empty placeholder, create a control with the dynamic content I want. Upload the masterpage, edit the template and drop in the control. Remembering that the only thing that can really be placed in a placeholder by Sitefinity, is a control.
  11. Michael
    Michael avatar
    17 posts
    Registered:
    12 Oct 2008
    26 Jan 2009
    Link to this post
    My bad...I created a folder for my site called "MyMasterPages" and was storing the master pages I created in this folder.

    I did not realize that upon upload of a master page the uploaded master goes to the App_Master folder.  Thus any future chnages need to be made to the file in the app+master folder, not the original that I created in MyMasterPages.

    Sorry for any confusion.
  12. Jamie
    Jamie avatar
    25 posts
    Registered:
    07 Aug 2012
    27 Jan 2009
    Link to this post
    I'm having a similar problem. Adding a Site Menu to my template caused an error because there was no ScriptManager in the master page. I edited the master page (in App_Master) and added the ScriptManager but that did not clear the error. I ended up deleting the template and uploading it again.

    Why did my template not reflect the change?
  13. Jamie
    Jamie avatar
    25 posts
    Registered:
    07 Aug 2012
    27 Jan 2009
    Link to this post
    I'm having a similar problem. Adding a Site Menu to my template caused an error because there was no ScriptManager in the master page. I edited the master page (in App_Master) and added the ScriptManager but that did not clear the error. I ended up deleting the template and uploading it again.

    Why did my template not reflect the change?
  14. Sharon
    Sharon avatar
    28 posts
    Registered:
    29 Jul 2008
    27 Jan 2009
    Link to this post
    What worked for me was to go to Files then the App_Master folder. I right clicked on the .master and .master.vb and deleted them. (This only removes them from Sitefinity it doesn't actually delete the files). Then I uploaded them again.

    Then the changes showed up in my template. The only trouble I ran into with this was when I renamed my containers.
  15. Jamie
    Jamie avatar
    25 posts
    Registered:
    07 Aug 2012
    27 Jan 2009
    Link to this post
    I've found that I have to restart IIS for any changes to master pages or themes to get picked up. It's probably something specific to my system because I also have to restart IIS twice to get throught project creation. It's a real drag.
  16. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    27 Jan 2009
    Link to this post
    i've only had to force a recompile by re-saving the web.config. takes only a few seconds and the new templates show up right after.

    would be a good idea to do some kind of file scan instead. it might be less optimized to do it each time, but templates shouldn't change so frequently so it might be worth it... just an idea anyway
Register for webinar
16 posts, 0 answered