The page layout contains all of the Content Controls that match the content placeholders from the master page file. For example, the matching content control from our sample master page content placeholder from above would look like this:
Insert field controls, web part zones or HTML code here
Page layout content should be content that will change from page to page, for example:
- Title, Author, Byline
- Body Text
With the exception of the Registry tags, nothing can be outside of a content control in the page layout file! If you try to wrap HTML or add extra code outside of the content control, it will break the page.
SharePoint content is added to the content controls in a page layout in one of two ways, Field Controls or Web Part Zones.
Field Controls are content areas that map to columns in the Content Type. Field control placement is controlled in the page layout file and can’t be moved by the content editor through the web interface. They are ideal for situations where excerpts of content need to remain in a fixed location on a site. A field control looks similar to this:
Web Part Zones on the other hand allow content editors to add and move content around on the page. They work very similar to how they did in SharePoint 2003. The web part zone is specified in the page layout, and then the content editor can choose to add, remove or rearrange web parts within the specified zones. A web part zone looks similar to this:
Content Types are a new feature/concept of SharePoint 2007. They definitely warrant learning about and gaining an understanding of. A content type is a collection of settings that is applied to a particular category of content that can be reused multiple times. Through content types you can manage metadata and the behavior of a document or item type in a central, reusable way. Please refer to the following additional resources for a more in depth explanation of content types:
Columns from a content type are referenced through the field controls in the page layout. One content type can be reference by multiple page layouts, but a page layout can only reference one content type. This allows you to easily change the page layout of a page in a site without compromising the content since the content is controlled in the content type. The only restriction is to change the page layout to another page layout that is based on the same content type as the original
All of the components that contribute to the rendered SharePoint page is stored in silos… master page, page layout, page, content type and all the bits in between that link them together. To connect it all:
- A Page is stored in a Pages library within a site.
- The Page references a Content Type that helps populate the page with data. Content types are stored within a site.
- A Page Layout is applied to the Page to control what content appears and where through the use of Field Controls and Web Part Zones. This is specified within the Content Controls in the Page Layout.
- A Master Page is applied to the site to wrap on the look and feel and control content placement from the Page Layout through the use of Content Placeholders.