Question

Same as for a custom v4.master, I want to create a custom minimal.master. The common advice: make a copy of minimal.master and then modify it. But how can I reference to the custom minimal.master? ( Such as for the v4.master, this can be changed by the Site Settings. )

Était-ce utile?

La solution

Depending on how much you need to customize minimal.master you have two options:

  1. If it's enough to be able to insert special css/javascript, then you can use a Control element to replace the DelegateControl with id "MinimalMasterSiteLogo"
  2. If you need completely new html, then you have to overwrite minimal.master in the LAYOUTS folder as the pages using minimal.master refer to it directly.
    1. Remember that this will affect all sites!!!!
    2. Remember to keep a copy of both the original and the custom one, the first to use if there is any problems, the second to when a patch/SP overwrites your custom one.

BUT if you're developing for Office365 or another environment where you can only deploy sandboxed solutions then neither of the above will work. Then you have to resort to the following hack:

  1. Create a sandboxed solution (or extend an existing one)
  2. Add a new item of type Module (I call mine ChangeMiniMaster)
  3. Change sample.txt to a javascript file (I call mine ChangeMiniMaster.js)
  4. Add a CustomAction element to the Elements.xml like this:

    <CustomAction  
      ScriptSrc="~SiteCollection/ChangeMiniMaster/ChangeMiniMaster.js"  
      Location="ScriptLink"  
      Sequence="1000">  
    </CustomAction>
    

The javascript file will be loaded on every page so you have to make some check to see if you're on a page using minimal.master (I check for an element with the id 's4-mini-testarea') and then you have to make all your changes using javascript.
Here is a small example:

function changeMiniMasterInit() {
    var miniTitleArea = $get('s4-mini-titlearea');
    if (miniTitleArea) {
        miniTitleArea.innerHTML = "This is my special title area";
    }
}
_spBodyOnLoadFunctionNames.push('changeMiniMasterInit')

Autres conseils

Are you asking how to load the custom master page? It should be referenced just like a custom v4.master. All you need to do is upload and publish the custom.master file and then it should be in the dropdown.

SharePoint Designer could be used as well.. just right-click and activate as custom master or default master..

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top