Heather Solomon's Blog

SharePoint 2007 Branding

Article Categories
Post Categories


  Jump to: Follow speheather on Twitter Follow Heather Solomon on Facebook
Heather's SharePoint 2010 Blog is located at blog.sharepointexperience.com
Loading

Minimal or Base Master Pages


The following is a collection of stripped down master pages for your use with SharePoint 2007 sites. The master pages that ship with SharePoint (default.master, blueband.master, etc) are full of formatting code for the respective design for the master page, so to create your own master page you have to copy a master page and strip out all of formatting code (HTML, etc) in the file. With these base master pages, I have done that step for you, plus included comments tagging the Content Placeholders so you quickly identify the Content Placeholders and handle them how you see fit.

Below are some commonly asked questions, and a few notes about the file.

PLEASE NOTE

Please note that the base master pages include the HTML Transitional DTD that will display your site in quirks mode.  Please replace the DTD if you need a more refined presentation mode for your site. A bit more info... or a lot more info.

FAQ

  1. What is a Master Page?
    Please read this post: MOSS 2007 Design Component Relationships and Diagrams.  
  2. Hey, can't I just create my own master page?
    Sure, but it is a long process. There is a set of Content Placeholders that must be included in your master page in order for it to run in SharePoint. The point of the base master pages is to provide you with that set of Content Placeholders without all of the formatting code.  
  3. OK I downloaded this code, now what?
    Create a master page in your development SharePoint site. Paste in the base master page code (in lieu of the code that is added when the file is created) and save the file to your master page gallery. I suggest using SharePoint Designer to complete these actions. In your site, apply the master page in Site Settings. View your page. Your site should now show just the Content Placeholders.  
  4. Gak! My site looks weird now, everything is just stacked on top of each other!
    Yup, the base master page has no formatting code. Take a look at your master page file and you will just see Content Placeholders. Now it is up to you to add HTML and the like to format your site. It is like putting together a puzzle, you will need to add your formatting code and piece in the Content Placeholders where you need the various SharePoint elements.  
  5. There are Content Placeholders I don't want in my site, what do i do?
    Don't delete them! The Content Placeholders have to stay in the file for SharePoint to run. If there is a Content Placeholder you don't want to use, move the code to the hidden ASP Panel located at the bottom of the file. This is a nifty trick, the ASP Panel has the visibility set to false, so while the Content Placeholders are included in the file (and ultimately your site) everything is hidden from view. You can place as few or as many Content Placeholders in this hidden panel as you like.  
  6. The base master page still has some stuff that looks like SharePoint, why is that happening?
    If you take a look at the screen shots for each base master page or at your site after applying it, there are some items that still look like SharePoint such as navigation and the web part title bars. This is because the user controls that control these elements include CSS styles outside of the master page. In order to update the look and feel of these items, you need to override the CSS that is being used for the elements. Use my CSS reference chart to help with this process.

    AND THE NUMBER ONE QUESTION I GET:

  7. I applied the base master page, but when I view my site, I get an error.
    If all you have done is paste in my base code, make sure that the Registry tags in the top of the file still has some tildes in some key spots. Anywhere there is a reference to /_controltemplates, there should be a tilde (~) before the forward slash. Avoid losing these tildes by opening the base master page file in another application other than SharePoint Designer (such as Visual Studio or Notepad) and copying the code from there for your paste into your new master page file in SharePoint Designer. See below for a code sample. 

     <%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %> 

     If you have started moving around Content Placeholders and editing the file and you get a site error, you have probably deleted a neccessary Content Placeholder or accidentally edited something to make the Content Placeholder invalid. The best thing to do is to turn off friendly error messages for your site and view the page again. Then SharePoint will tell you exactly what it is hanging up on. See the end of this page for instructions on how to turn off friendly error messages for your site.

For each base master page, there is a link to the code, and a link to a sample screen shot of what your site will look like after applying the master page code.

MOSS Collaboration Site Base Master Page AND WSS Base Master Page

There is no difference between master pages for a collaboration MOSS site and a WSS site.

MOSS Publishing Site Base Master Page

Turn off Friendly Errors

While in development, the friendly error page that SharePoint displays when your page has an error can make debugging your master page issues very difficult. You can make an easy change to your Web config file for the site to turn friendly error messages off, therefore providing you with more useful information if your page breaks. Only do the following in a development environment, you would never want to turn off friendly error messages in a production environment. Also be sure to make a back up of the file prior to editing.

  1. On the Web server, navigate to the site directory:
    Local Drive:\Inetpub\wwwroot\wss\VirtualDirectories\[directory for site] (for example 84)
  2. Open Web.config in Notepad.
  3. Search for "CallStack". Change the CallStack status to "true".
    <SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">
  4. Search for "CustomErrors". Change the mode to "off".
    <customErrors mode="Off" />
  5. Save and close the file.
Now when your site encounters an error, you will receive a .NET screen outlining the issue instead of the friendly SharePoint error screen. This is particularly useful with dealing with missing Content Placeholders and editing Master Pages. To turn friendly error messages back on, just walk through these steps setting the CallStack to false and CustomErrors mode to On.
posted on Thursday, June 07, 2007 9:54 AM

Copyright © 2005-2011. Heather Solomon.
Site design by Heather Solomon. Yes it is dated and purple. If I changed it, no one would recognize it! Check out my new home at sharepointexperience.com.

Blog Stats:
Posts - 390
Stories - 39
Comments - 1795
Trackbacks - 183
Follow speheather on Twitter

Follow Heather Solomon on Facebook

Branding/UI/UX Courses for SharePoint taught by Heather Solomon

VIEW COURSE SCHEDULE