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" />
</td>
<td> </td>
<td valign="top" width="30%">
<WebPartPages:WebPartZone runat="server"
FrameType="TitleBarOnly" ID="Right"
Title="loc:Right" />
</td>
<td> </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.