创建母版页步骤 :

 

MOSS 要求一个母版页必须包含标题、图标、登陆、搜索等区域和一些基础结构元素包括页面区域、分格栏、边框、控制台和描述文字PlaceHolder。

    MOSS提供的母版页需要基于WSS的SPWeb类下的SPWeb.CustomMasterUrl。

    建立一个最精简的母版页步骤如下。

    step(1): 打开Sharepoint Designer.

    step(2): 在文件菜单点击New,选择Sharepiont Content,选择Page 标签。

    step(3): 双击母版页来创建一个母版页。

    step(4): 选择在设计模式下查看母版页,母版页覆盖了头部和左边的一些区域,几个content placeholders是可见的。

    step(5): 选择在代码模式下查看母版页。

    step(6): 把下面的代码拷贝并粘贴到母板页中。

 

sharepoint Designer创建母版页步骤_其他<%-- Identifies this page as a .master page written in C# and registers tag prefixes, namespaces, assemblies, and controls. --%>
sharepoint Designer创建母版页步骤_其他<%@ Master language="C#" %>
sharepoint Designer创建母版页步骤_其他_03<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
sharepoint Designer创建母版页步骤_其他<%@ Import Namespace="Microsoft.SharePoint" %>
sharepoint Designer创建母版页步骤_其他<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
sharepoint Designer创建母版页步骤_其他<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
sharepoint Designer创建母版页步骤_其他<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
sharepoint Designer创建母版页步骤_其他<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
sharepoint Designer创建母版页步骤_其他<%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
sharepoint Designer创建母版页步骤_其他<%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %>
sharepoint Designer创建母版页步骤_其他<%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" src="~/_controltemplates/DesignModeConsole.ascx" %>
sharepoint Designer创建母版页步骤_其他<%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %>
sharepoint Designer创建母版页步骤_其他<%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %>
sharepoint Designer创建母版页步骤_其他<%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" src="~/_controltemplates/PublishingActionMenu.ascx" %>
sharepoint Designer创建母版页步骤_其他<%-- Uses the Microsoft Office namespace and schema. --%>
sharepoint Designer创建母版页步骤_其他_03<html>
sharepoint Designer创建母版页步骤_其他_03  <WebPartPages:SPWebPartManager runat="server"/>
sharepoint Designer创建母版页步骤_其他_03  <SharePoint:RobotsMetaTag runat="server"/>
sharepoint Designer创建母版页步骤_其他_03
sharepoint Designer创建母版页步骤_其他  <%-- The head section includes a content placeholder for the page title and links to CSS and JavaScript files that run on the server. --%>
sharepoint Designer创建母版页步骤_其他_03  <head runat="server">
sharepoint Designer创建母版页步骤_其他_03    <asp:ContentPlaceHolder runat="server" id="head">
sharepoint Designer创建母版页步骤_其他_03      <title>
sharepoint Designer创建母版页步骤_其他_03        <asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server" />
sharepoint Designer创建母版页步骤_其他_03      </title>
sharepoint Designer创建母版页步骤_其他_03    </asp:ContentPlaceHolder>
sharepoint Designer创建母版页步骤_其他_03    <Sharepoint:CssLink runat="server"/>
sharepoint Designer创建母版页步骤_其他_03    <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server" />
sharepoint Designer创建母版页步骤_其他_03  </head>
sharepoint Designer创建母版页步骤_其他_03  
sharepoint Designer创建母版页步骤_其他  <%-- When loading the body of the .master page, MOSS 2007 also loads the SpBodyOnLoadWrapper class. This class handles .js calls for the master page. --%>
sharepoint Designer创建母版页步骤_其他_03  <body onload="javascript:_spBodyOnLoadWrapper();">
sharepoint Designer创建母版页步骤_其他    <%-- The SPWebPartManager manages all of the Web part controls, functionality, and events that occur on a Web page. --%>
sharepoint Designer创建母版页步骤_其他_03    <form runat="server" onsubmit="return _spFormOnSubmitWrapper();">
sharepoint Designer创建母版页步骤_其他_03      <wssuc:Welcome id="explitLogout" runat="server"/>
sharepoint Designer创建母版页步骤_其他_03      <PublishingSiteAction:SiteActionMenu runat="server"/>  
sharepoint Designer创建母版页步骤_其他_03      <PublishingWebControls:AuthoringContainer id="authoringcontrols" runat="server">
sharepoint Designer创建母版页步骤_其他_03        <PublishingConsole:Console runat="server" />
sharepoint Designer创建母版页步骤_其他_03      </PublishingWebControls:AuthoringContainer>
sharepoint Designer创建母版页步骤_其他      <%-- The PlaceHolderMain content placeholder defines where the page content should go for all the content from the page layout. The page layout can overwrite any content placeholder from the master page. Example: The PlaceHolderLeftNavBar can overwrite the left navigation bar. --%>
sharepoint Designer创建母版页步骤_其他_03      <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" />
sharepoint Designer创建母版页步骤_其他_03        <asp:Panel visible="false" runat="server">
sharepoint Designer创建母版页步骤_其他        <%-- These ContentPlaceHolders are only necessary to ensure all out of the box MOSS 2007 pages render with this master page. If the system master page is set to any default master page, the only content placeholders required are those that are overridden by your page layouts. --%>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea"  runat="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder ID="PlaceHolderPageImage" runat="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder ID="PlaceHolderBodyLeftBorder" runat="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder ID="PlaceHolderNavSpacer" runat="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder ID="PlaceHolderTitleLeftBorder" runat="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder ID="PlaceHolderTitleAreaSeparator" runat="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder ID="PlaceHolderMiniConsole" runat="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat ="server" />
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat ="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat ="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat ="server"/>
sharepoint Designer创建母版页步骤_其他_03<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat ="server"/>
sharepoint Designer创建母版页步骤_其他_03</asp:Panel>
sharepoint Designer创建母版页步骤_其他_03    </form>
sharepoint Designer创建母版页步骤_其他_03  </body>
sharepoint Designer创建母版页步骤_其他_03</html>
sharepoint Designer创建母版页步骤_其他_03




    step(7): 将文件另存为一个.master后缀名的母版页文件到站点集的母版页库(/_catalogs/masterpage)。

 

   说明:实际上在下面的visible=false的pannel中的placeholder都是可选的,根据需要设置这些placeholder的可见性就可以,如果就是一个空白的站点,那么这些placeholder一个都不需要。但要保证其它的结构是正确的。