Composite Apps - SPD and Master Pages

One of the great things about SharePoint 2007 is that it was built as an ASP.NET 2.0 web application which means that it can take advantage of the new features in ASP.NET 2.0, including Master Pages.  Master Pages allow you to define the overall structure for your web site by creating content placeholders inside of an HTML structure.  Those placeholders are then merged with content defined in content pages.  The resulting page is then sent to the browser.  Let's take a look at how this works in SharePoint:

When you open a Windows SharePoint Services site in SharePoint Designer your folder list view should look similar to this:

image

In Windows SharePoint Services, each WSS site has an _catalogs folder which contains a "Master Page Gallery" document library.  This document library stores your Master Pages (which have a .master file extension).  When you open the default.master page you can see it looks very similar to any other html/aspx page opened in SharePoint Designer:

image

The main difference in a Master Page is the purple rectangles that represent content placeholders.  When you click inside of the placeholders they highlight and display their id:

image

if we switch to code view you can see what makes up a content placeholder:

image

This content placeholder does not define any default content, therefore, it will display empty unless it is overridden in a content page.  Some content placeholders contain default content which will be displayed unless overridden in a content page.

image 

That covers the basics of Master Pages in SharePoint.  Next we'll take a look at a content page and how it relates to a Master Page.

For more information on ASP.NET 2.0 Master Pages, take a look at the ASP.NET Master Pages Overview on MSDN:  http://msdn2.microsoft.com/en-us/library/wtxbf3hh.aspx, especially this graphic which shows the relationship between a Master Page and a content page.


Posted 02-04-2008 7:15 AM by Raymond Mitchell
Inetium, LLC. Site Information