This short article demonstrates the use of ASP.NET 2.0 master pages and content pages in Windows SharePoint Services v3.0. Since WSS 3.0 uses ASP.NET 2.0 to provide core functionality, it is worth documenting how SharePoint builds upon the master/content page concept to provide site customization.
The web hosts many articles, which explain the concept of master pages. The following link provides access to an article, from MSDN magazine, which is a good primer on master page technology. This article assumes the reader has some prior knowledge on web site construction in ASP.NET 2.0, using master pages.
http://msdn.microsoft.com/msdnmag/issues/04/06/ASPNET20MasterPages/
The Global Master Page
Master pages allow multiple levels of nesting. All sites in SharePoint use the default.master master page located in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL directory. This default master page is the global master page. Any changes made to the global master page file will affect all sites in SharePoint, even the central administration web site.
Master Page Editing in SharePoint Designer
The SharePoint Designer is the replacement for the legacy Front Page tool. SPD allows designers to customize the look and feel of SharePoint web sites using a rich UI editor. After opening a SharePoint web site, the folder list in SPD (top left) displays the various pages, lists, and templates that participate in the construction of the site just opened. The site master page is located at _catalogs/masterpage/default.master.
Looking at the site master page in the designer, the XHTML markup is identical to that of the global master page. This is because they are actually the same file prior to any edits. Making a change to the site master page, followed by a save operation, causes SPD to create a customized version of the master page in the SharePoint database – this is referred to as page customizing, or un-ghosting. When customizing a page, the physical disk file is left untouched, and the database contains the customizations made to the site.
Note: Any changes made to the site master pages will affect all pages in the site, with the exception of pages in the _layouts directory. These pages are non-site specific, and use a different master page (also located in the _layouts directory). On example page that is non-site specific, is the “settings” page.
The SharePoint Designer now allows designers to revert customized pages back to the template version – a feature that was much desired in Front Page. A right click on the customized file presents a context menu that includes this option.
Content Pages
Content pages in SharePoint link to the template master page via the MasterPageFile attribute in the Page declaration. The URL to the default master page is typically ~masterurl/default.aspx. The ~masterurl refers to the location of the site master page, which is managed by SharePoint.
The master pages in SharePoint define a number of content placeholders. These content placeholders define areas on pages in which developers can customize the content. SharePoint defines default content for most of the placeholders not overridden by users.
Most SharePoint pages contain a PlaceHolderMain placeholder where the bulk of the main content lives. Typically, this placeholder will contain a web part zone for dropping web parts, but developers are free to place anything they like.
Content placeholders defined in SharePoint master pages are as follows:
Name of Content Placeholder | Description |
PlaceHolderAdditionalPageHead | Additional content that needs to be within the <head> tag of the page, for example, references to script in style sheets |
PlaceHolderBodyAreaClass | Additional body styles in the page header |
PlaceHolderBodyLeftBorder | Border element for the main page body |
PlaceHolderBodyRightMargin | Right margin of the main page body |
PlaceHolderCalendarNavigator | Shows a date picker for navigating in a calendar when a calendar is visible on the page |
PlaceHolderFormDigest | The "form digest" security control |
PlaceHolderGlobalNavigation | The global navigation breadcrumb |
PlaceHolderHorizontalNav | Top navigation menu for the page |
PlaceHolderLeftActions | Bottom of the left navigation area |
PlaceHolderLeftNavBar | Left navigation area |
PlaceHolderLeftNavBarBorder | Border element on the left navigation bar |
PlaceHolderLeftNavBarDataSource | Data source for the left navigation menu |
PlaceHolderLeftNavBarTop | Top of the left navigation area |
PlaceHolderMain | Page's main content |
PlaceHolderMiniConsole | A place to show page-level commands, for example, WIKI commands such as Edit Page, History, and Incoming Links |
PlaceHolderNavSpacer | The width of the left navigation area |
PlaceHolderPageDescription | Description of the page contents |
PlaceHolderPageImage | Page icon in the upper left area of the page |
PlaceHolderPageTitle | The page <Title> that is shown in the browser’s title bar |
PlaceHolderSearchArea | Search box area |
PlaceHolderSiteName | Site name |
PlaceHolderTitleAreaClass | Additional styles in the page header |
PlaceHolderTitleAreaSeparator | Shows shadows for the title area |
PlaceHolderTitleBreadcrumb | Main content breadcrumb area |
PlaceHolderTitleInTitleArea | Page title shown immediately below the breadcrumb |
PlaceHolderTitleLeftBorder | Left border of the title area |
PlaceHolderTitleRightMargin | Right margin of the title area |
PlaceHolderTopNavBar | Top navigation area |
PlaceHolderUtilityContent | Extra content that needs to be at the bottom of the page |
SPNavigation | Empty by default in Windows SharePoint Services Used for additional page editing controls |
WSSDesignConsole | The page editing controls when the page is in Edit Page mode (after clicking Site Actions, then Edit Page)
|
