MOSS母版頁制作學習筆記(一) 收藏 母版頁制作其實應該算是一個比較基礎的工作,但是熟練制作出靈活,、完整的母版頁的人卻很少。,。為什么會這樣呢,分析原因有幾個,,主要的問題應該是母版頁制作是介于開發(fā)和美工之間的工作,開發(fā)人員關注代碼,,美工關注界面效果,就忽略和回避了這部分,,都不愿意作怎么辦,那就我來作吧,。,。 首先MOSS的母版頁也是來自于asp.net的母版頁,,原理都是一樣的。 基于微軟提供的文檔,,母版頁制作有兩種方式:一,布局變化不大的情況下,,在原母版頁上修改,;二,,重新制作,。 我們主要說說重新制作吧。,。 最簡單的理解就是: 第一,,先知道哪些是母板頁中必須有的元素,; 第二,從美工處拿到界面的展示效果和html布局,,css樣式表; 第三,,從SPD創(chuàng)建一個新的母版頁,將html代碼復制進去,; 第四,,將css放到相應位置,母版頁應用對應的css,; 第五,,將美工模擬的控件用母版頁中的占位符替換; 第六,,除了必須的元素外,,還需要添加什么附加控件,也加到相應的位置,; 完成! 下面詳細說下每一步: 一,、哪些是母板頁中必須有的元素 空白的,,沒有樣式的包括所有占位符的母版頁: <%-- Identifies this page as a .master page written in C# and registers tag prefixes, namespaces, assemblies, and controls. --%> <%@ Master language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www./TR/html4/loose.dtd"> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, 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="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %> <%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" src="~/_controltemplates/DesignModeConsole.ascx" %> <%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %> <%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %> <%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" src="~/_controltemplates/PublishingActionMenu.ascx" %> <%-- Uses the Microsoft Office namespace and schema. --%> <html> <WebPartPages:SPWebPartManager runat="server"/> <SharePoint:RobotsMetaTag runat="server"/> <head runat="server"> <asp:ContentPlaceHolder runat="server" id="head"> <title> <asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server" /> </title> </asp:ContentPlaceHolder> <Sharepoint:CssLink runat="server"/> <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server" /> </head> <body onload="javascript:_spBodyOnLoadWrapper();"> <form runat="server" onsubmit="return _spFormOnSubmitWrapper();"> <wssuc:Welcome id="explitLogout" runat="server"/> <PublishingSiteAction:SiteActionMenu runat="server"/> <PublishingWebControls:AuthoringContainer id="authoringcontrols" runat="server"> <PublishingConsole:Console runat="server" /> </PublishingWebControls:AuthoringContainer> <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" /> <asp:Panel visible="false" runat="server"> <asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/> <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"/> <asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server"/> <asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server"/> <asp:ContentPlaceHolder ID="PlaceHolderPageImage" runat="server"/> <asp:ContentPlaceHolder ID="PlaceHolderBodyLeftBorder" runat="server"/> <asp:ContentPlaceHolder ID="PlaceHolderNavSpacer" runat="server"/> <asp:ContentPlaceHolder ID="PlaceHolderTitleLeftBorder" runat="server"/> <asp:ContentPlaceHolder ID="PlaceHolderTitleAreaSeparator" runat="server"/> <asp:ContentPlaceHolder ID="PlaceHolderMiniConsole" runat="server"/> <asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat ="server" /> <asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat ="server"/> <asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat ="server"/> <asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat ="server"/> <asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat ="server"/> </asp:Panel> </form> </body> </html> 然后我們來分別認識下這些占位符: 1、<asp:ContentPlaceHolder ID="PlaceHolderGlobalNavigationSiteMap" runat="server" /> 就是一般放在最上面一行顯示站點名稱的,,點擊返回到首頁,;這是占位符,包含控件默認的寫法是: <asp:ContentPlaceHolder id="PlaceHolderGlobalNavigationSiteMap" runat="server"> <asp:SiteMapPath SiteMapProvider="SPSiteMapProvider" id="GlobalNavigationSiteMap" RenderCurrentNodeAsLink="true" SkipLinkText="" NodeStyle-CssClass="ms-sitemapdirectional" runat="server"/> </asp:ContentPlaceHolder> 2,、<asp:ContentPlaceHolder ID="PlaceHolderGlobalNavigation" runat="server" /> 放置頂部一行內(nèi)容的占位符,;一般中間可以加上表格,并放上需要的東西,,例如歡迎信息,,我的站點等,。例如歡迎信息: <asp:ContentPlaceHolder ID="PlaceHolderGlobalNavigation" runat="server"> <wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false"></wssuc:Welcome> </asp:ContentPlaceHolder> 歡迎信息也可以單獨拿出來放在其他位置。
3,、<asp:ContentPlaceHolder ID="PlaceHolderSiteName" runat="server" /> 放置LOGO旁邊的大的站點名稱的占位符;中間加了內(nèi)容的默認寫法是: <SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitle"> <SharePoint:ProjectProperty Property="Title" runat="server" /> </SharePoint:SPLinkButton>
本文來自CSDN博客,,轉(zhuǎn)載請標明出處:http://blog.csdn.net/zengjibing/archive/2009/01/17/3815427.aspx
|