Share via


Page Layouts and Master Pages

Publishing in Microsoft Office SharePoint Server 2007 is fundamentally a means of authoring and displaying information by using a set of templates. With regard to publishing in Office SharePoint Server 2007, there are two fundamental templates to understand: master pages and page layouts.

Master pages and page layouts dictate the overall look and feel of your SharePoint site. Master pages contain controls that are shared across multiple page layouts, such as navigation, search, or language-preference for multilingual sites. Page layouts contain field controls and Web Parts. The following figure shows how page layouts and master pages work together to create the layout for a Web page.

Relationship between page layouts and master pages

With master pages, you can easily provide a consistent look and feel for your site. You can use master pages to position items that must be shared by all pages, such as navigational controls, company logos, and copyright notices. Within master pages, you can use Microsoft ASP.NET 2.0 user controls (.ascx controls), Web server controls, and Web Parts.

The top-level SharePoint site for a site collection hosted on Office SharePoint Server 2007 has a special document library called the Master Page and Page Layout Gallery. All page layouts and master pages are stored in this document library. The Master Page and Page Layout Gallery supports versioning and workflow, so you leverage those features for your master pages and page layouts.

Note

By default, Office SharePoint Server 2007 creates a master page gallery for every site; however, you can only create new pages with the page layouts stored in the master page gallery of the top-level site in the site collection.

All page layouts reference a master page that is based on the CustomMasterUrl property of the SPWeb class. All page layouts host controls called field controls that bind to fields on the master page list item. You can use the default controls or build custom ones. Field controls allow content to be edited and rendered for display, just as placeholder controls in MCMS 2002 do. To see a code example for creating and using a custom field control, see How to: Create a Custom Field Control.

Note

When you perform a content migration from MCMS 2002, Office SharePoint Server 2007 creates a set of folders for keeping the Template Gallery structure. In each folder, it generates a basic, default page layout for each template gallery item that was present in MCMS.

Page layouts can be used by all page instances that are based on that page layout. Master pages can be used by all page instances in a site. Page instances based on the same page layout in different sites can use different master pages.

For more information about master pages, see the Microsoft Windows SharePoint Services 3.0 SDK, as well as the ASP.NET Developer Center.

See Also

Tasks

How to: Create a Minimal Master Page

Concepts

Page Layout Model
Page Processing Model