Master Pages Definition(SharePoint 2007 SDK)

Understanding the Structure of Master Pages

Each page that a visitor sees in the browser when navigating to an Office SharePoint Server 2007 site is a combination of a master page and a published page based on a particular page layout (a template).

The site master page is stored at the level of the site collection in the master page gallery. Every site has an association with a master page. The pages published in the site adopt the appearance and expose the navigation controls defined by the master page.

Office SharePoint Server 2007 is an excellent product to use to explore the various elements that make up a master page. You can use Microsoft Office SharePoint Designer 2007 to open one of your sites that uses the WCM features. For this article, I use the Publishing Portal as an example. In the folder list, expand the _catalogs node and the masterpage node. Double-click BlueBand.master and confirm that you want to check out the file. Switch to Split mode so that you have the designer and the code editor visible, as shown in Figure 1.

Figure 1. BlueBand.master open in SharePoint Designer

Controls whose names are prefixed with "SPSWC", "SharePoint", or "WebPartPages" are the Web controls or Web Parts that are available via Microsoft.SharePoint.Portal.dll or Microsoft.SharePoint.dll. They are part of Windows SharePoint Services or the additions provided by Office SharePoint Server 2007. You find these controls in all sites, even those that do not have the WCM features enabled.

One example is the control for delivering search in the page. The navigation controls embedded in the master page are examples of controls that come with Windows SharePoint Services (Figure 2).

The published pages can contain Web Parts. The master page contains the SPWebPartManager control, which coordinates the Web Parts embedded in these pages.

Figure 2. Web controls and navigation controls in the master page

Publishing Controls

Controls whose names are prefixed with "PublishingWebControls" and "PublishingNavigation" are the Web controls that deliver the WCM features for the site.

The PublishingWebControls:AuthoringContainer control, which is provided by Microsoft.SharePoint.Publishing.dll, creates the top part of the page (Figure 3). It is the container for the Welcome user control, the Site Actions menu, and the Microsoft ASP.NET user control that renders the authoring console.

Figure 3. Authoring Container in the master page

The publishing controls that are identified by the prefix "PublishingNavigation" (and also provided by Microsoft.SharePoint.Publishing.dll) are Web controls not directly visible on the page. The PortalSiteMapDataSource Web control adds a layer on top of the Site Map Provider model that is part of ASP.NET 2.0. The ASP.NET 2.0 Site Map Provider model gives developers a pluggable navigation model in which the user interface (UI) and the data source are separated. Windows SharePoint Services 3.0 and Office SharePoint Server 2007 add features, of which the most important is security trimming. Figure 4 shows an overview of the interaction that occurs among the various components that drive the navigation in your SharePoint sites.

Figure 4. Components of the Site Map Provider model

Three PortalSiteMapDataSource controls are embedded. Each maps to a definition for a provider within the web.config file of the site. The SiteMapDataSourceRoot control uses the CombinedNavSiteMapProvider control and is connected to the breadcrumb controls. As its name suggests, it combines the two other PortalSiteMapDataSource controls into one. The siteMapDataSource1 control provides the data for the top navigation bar, and the siteMapDS control provides the data for the vertical navigation control.

ASP.NET User Controls

In addition to the ASP.NET server controls, you also find ASP.NET user controls (.ascx files) embedded in the master page:

·         Welcome.ascx is displayed at the top of your page. You will find this control on all of your SharePoint sites (even those that do not use WCM).

·         VariationsLabelMenu.ascx is displayed when a page is part of a variation hierarchy. The user can quickly jump to the same page in another variation by using this control (Figure 5).

Figure 5. ASP.NET user control that allows users to jump to the same page in another language

·         PublishingConsole.ascx controls all the steps within the publishing cycle of a page (Figure 6). I discuss this control in more detail later, in the section titled Customizing the Edit Mode Experience.

Figure 6. The console used by content authors and anybody involved with the publishing cycle of a page

·         PublishingActionMenu.ascx is the user control that delivers the Site Actions menu, which is different from the user control you use on sites that do not have the WCM features enabled.

The last set of controls in the master page is the ASP.NET ContentPlaceHolder controls. The most important one is the PlaceHolderMain control, which indicates where Windows SharePoint Services inserts the actual content page.

Understanding the Default Master Pages

Different master pages are available with Windows SharePoint Services 3.0 and Office SharePoint Server 2007. We have looked in detail at BlueBand.master, but you can use others as starters.

To explore the differences with the others available, click Site Settings and then, in the Look and Feel section, click Master Page. On the Site Master Page Settings page you can change the site master page to any of the master pages stored in the master page gallery:

·         Default.master is used for the Windows SharePoint Services team sites. You can use the same design for your site.

You might have the impression that all of the controls discussed are present in default.master, but if you open default.master in Office SharePoint Designer 2007, you notice that the page does not contain the publishing controls directly. Each control is inserted by a DelegateControl control. For example, the following is the definition of the Publishing Console in the master page.

Xml

<SharePoint:DelegateControl runat="server" ControlId="PublishingConsole" 
  PrefixHtml="&lt;tr&gt;&lt;td colspan=&quot;4&quot;&gt;" 
  SuffixHtml="&lt;/td&gt;&lt;/tr&gt;">
</SharePoint:DelegateControl>

Delegate controls give you a powerful yet flexible approach to determine within your Feature which control to display. A Feature can, for example, define two search controls in the manifest file, each of them sequenced with a number. At run time, the delegate control on the page selects the search control that has the lowest sequence number and displays the control to the user. Delegate controls are heavily used by Office SharePoint Server 2007 to "light-up" or enable features in areas such as navigation and search.

You should avoid using this master page as the starter for your own custom master page if you want to provide a clean WCM infrastructure.

·         BlueBand.master, BlackBand.master, and BlueGlassBand.master belong to the same family and display both a top navigation bar and a left navigation bar. They are good candidates for your sites and good starting points for your own customizations.

·         BlueVertical.master and BlackVertical.master are master pages that are tuned for Internet sites, with a good representation of the WCM-related controls. They offer the same look and feel as the three master pages discussed in the previous bullet but do not contain the top navigation bar.

·         BlueTabs.master is also a valid alternative for the default master page. The difference is the tabbed representation of the top navigation bar.

·         OrangeSingleLevel.master and BlackSingleLevel.master are variations on the BlueBand master pages but with different color combinations.

reference:

http://carysun.javaeye.com/blog/463299

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值