Customizing WSS 3.0 with Master Pages
page 6 of 14
by Ameet Phadnis
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 89682/ 190

Master Pages, Content Place Holders and Site Definitions

Before we proceed, to create a simple Master Page using SharePoint Designer it would be good to know how the overall architecture works.

The Master Pages defines the layout which holds the Content Place holders that will be filled in by Site Definition ASPX Pages. The site definition ASPX pages are located under the SiteTemplate folders. For example, SharePoint has STS site Definition which is located under 12hive\Templates\SiteTemplate\STS. The explanation of Site definitions is beyond the scope of this article. The Default.aspx page has nothing but information on what the Content Place Holders will hold. Typical default.aspx page looks like the following.

Listing 6 - Default.aspx

<%@ Page language="C#" MasterPageFile="~masterurl/default.master"    
    Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,
    Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" 
    Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, 
    PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" 
    Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, 
    PublicKeyToken=71e9bce111e9429c" %> 
<%@ Import Namespace="Microsoft.SharePoint" %> 
<%@ Register Tagprefix="WebPartPages" 
    Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, 
    Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server"> 
         <SharePoint:EncodedLiteral runat="server"
    text="<%$Resources:wss,multipages_homelink_text%>" 
    EncodeMethod="HtmlEncode"/> - 
<SharePoint:ProjectProperty Property="Title" runat="server"/>
</asp:Content> 
 <asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server">
    <IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt="">
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" 
    runat="server"> 
     <label class="ms-hidden">
        <SharePoint:ProjectProperty Property="Title" runat="server"/>
    </label> 
 </asp:Content> 
 <asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server"/> 
 <asp:Content ContentPlaceHolderId="PlaceHolderTitleAreaClass" runat="server"> 
 <style type="text/css"> 
 TD.ms-titleareaframe, .ms-pagetitleareaframe { 
         height: 10px; 
 } 
 Div.ms-titleareaframe { 
         height: 100%; 
 } 
 .ms-pagetitleareaframe table { 
         background: none; 
         height: 10px; 
 } 
 </style> 
 </asp:Content> 
 <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server"> 
         <META Name="CollaborationServer" Content="SharePoint Team Web Site"> 
         <script type="text/javascript"> 
         var navBarHelpOverrideKey = "wssmain"; 
         </script> 
 </asp:Content> 
 <asp:Content ContentPlaceHolderId="PlaceHolderSearchArea" runat="server"> 
         <SharePoint:DelegateControl runat="server" 
                 ControlId="SmallSearchInputBox" /> 
 </asp:Content> 
 <asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server"> 
 </asp:Content> 
 <asp:Content ContentPlaceHolderId="PlaceHolderPageDescription" runat="server"/> 
 <asp:Content ContentPlaceHolderId="PlaceHolderBodyAreaClass" runat="server"> 
 <style type="text/css"> 
 .ms-bodyareaframe { 
         padding: 0px; 
 } 
 </style> 
 </asp:Content> 
 <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> 
         <table cellspacing="0" border="0" width="100%"> 
           <tr> 
            <td class="ms-pagebreadcrumb"> 
                 <asp:SiteMapPath SiteMapProvider="SPContentMapProvider" 
                    id="ContentMap" SkipLinkText="" 
                    NodeStyle-CssClass="ms-sitemapdirectional" runat="server"/>
           </td> 
           </tr> 
           <tr> 
            <td class="ms-webpartpagedescription">
            <SharePoint:ProjectProperty Property="Description" 
                runat="server"/></td>
          </tr> 
           <tr> 
                 <td width="100%" valign="top"> 
                         <WebPartPages:WebPartZone runat="server"
                        FrameType="TitleBarOnly" ID="Top" Title="loc:Top" /> 
                 </td> 
           </tr> 
           <tr> 
                 <td> 
                  <table width="100%" cellpadding=0 cellspacing=0 
                    style="padding: 5px 10px 10px 10px;"> 
                   <tr> 
                    <td valign="top" width="70%"> 
                            <WebPartPages:WebPartZone runat="server" 
                            FrameType="TitleBarOnly" ID="Left" Title="loc:Left" />
                           &nbsp; 
                    </td> 
                    <td>&nbsp;</td> 
                    <td valign="top" width="30%"> 
                            <WebPartPages:WebPartZone runat="server" 
                            FrameType="TitleBarOnly" ID="Right" 
                            Title="loc:Right" />
                           &nbsp; 
                    </td> 
                    <td>&nbsp;</td> 
                   </tr> 
                  </table> 
                 </td> 
           </tr> 
           <tr> 
                 <td width="100%" valign="top"> 
                         <WebPartPages:WebPartZone runat="server"
                        FrameType="TitleBarOnly" ID="Bottom" Title="loc:Bottom" />
                </td> 
           </tr> 
         </table> 
 </asp:Content>

Notice that all the HTML code is within the Content Place Holders. Please note the MasterPageFile is set to Default.Master. You can change this setting to some other Master Page file you have created.

In Short, Master Pages contain the layout and Content Place holders and the Site Definition ASPX page defines the stuff that goes in the Content Place Holder.


View Entire Article

User Comments

Title: Edward   
Name: Logo Design
Date: 2012-07-06 4:10:56 AM
Comment:
I am impressed by the quality of information on this website. There are a lot of good resources here. I am sure I will visit this place again soon
Title: ExternalLInks display   
Name: Sam
Date: 2010-04-18 12:22:10 PM
Comment:
hey,
I was wasting sometime when i found something which most of us will tend to make mistake on:
http://baigadil.blogspot.com/2010/04/exterbal-links-in-sharepoint-aspmenu.html
Title: Any way to use Cascading Master pages   
Name: Diwakar
Date: 2008-09-05 5:05:33 PM
Comment:
Is there a way to use Cascading Master pages? The scenario i have is - the root site will have the default master page, the sub site should be able to use their own Master page. I don't want to copy all the contents from the default Master Page and copy it into the Sub site's master page and then add the new stuff. Rather i want to leave the common stuff in the default master page and create the Sub Site master page with new stuff only. And when a page from the Sub site is rendered it uses the combination of two master pages.
Is this possible??
Title: And for wss v3?   
Name: Omar Damiani
Date: 2008-05-02 8:56:04 AM
Comment:
But this works only for MOSS 2007, for wss v3 what do you have to do to create/add a new Master Page?

For wss v3 in the Site Settings you don't have "Master Page" voice in the "Look and Feel" menù (as explained in the "Assigning your Master Page to your site" section of this article...)
Title: great article   
Name: klibey
Date: 2008-04-25 11:32:50 AM
Comment:
you mentioned in the part about adding the sitemap provider to the web.config file...
siteMapFile="Menu.sitemap"

this makes sense, the only thing I am wondering is
where would I drop my sitemap file at?

Thanks for the excellent resource,

Klibey
Title: WSS or Moss   
Name: Manuelito
Date: 2007-09-06 7:51:00 AM
Comment:
Hi,
I think it's about master pages for WSS and MOSS (because you show us snapshots of moss publishing sites)

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-11-14 8:22:17 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search