7.2. Master Pages in Publishing Sites

Microsoft introduced master pages in ASP.NET 2.0. The concept is quite simple: A master page defines the general look and feel of a site, including CSS references, navigation, search, and the common top-branding most Web sites have. Master pages also contain content placeholders, which are sections of the page that can be replaced at runtime with other content. Developers create content pages that reference a specific master page, and the only markup these content pages contain are within content placeholders. The content placeholders in the master page are replaced at runtime with the contents defined within the content page.

SharePoint utilizes master pages a bit differently than a traditional ASP.NET 2.0 site. In ASP.NET 2.0, the master page is defined on a page-by-page basis. Instead, site owners and administrators specify the master page for a specific SharePoint site. All pages within that site are configured to use the master page specified for the current site. This is done using special master page tokens, which are covered later in the chapter. This advantage that SharePoint has over ASP.NET 2.0 enables site owners and administrators to change the master page of a site without touching the files on the file system or involving a developer.

Another difference between SharePoint's implementation of master pages and that of ASP.NET 2.0 is that the master pages in a SharePoint site are stored within a special document library: the Master ...

Get Professional SharePoint® 2007 Web Content Management Development: Building Publishing Sites with Office SharePoint Server 2007 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.