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): 19583/ 725

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

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 8 and 6 and type the answer here:

User Comments

Title: And for wss v3?   
Name: Omar Damiani
Date: 5/2/2008 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: 4/25/2008 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: 9/6/2007 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 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Ads Powered by Lake Quincy Media
Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 7/4/2008 5:51:13 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search