Monday, December 1, 2008

Dynamic Master Page , Application Page's Master Page

In sharepoint, the content page can use a master page like below.

<%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:webpartpageexpansion="full" meta:progid="SharePoint.WebPartPage.Document" %>

When MasterPageFile attribut is either "~masterurl/default.master" or "~masterurl/custom.master", the master page is dynamic master page, in this case you don't need to modify the content page to change its master page, master page is dynamically determined by two site property, "MasterUrl" or CustomMasterUrl. If you specify other values, then master page is bound.

  1. System Master Page

    Page language="C#" MasterPageFile="~masterurl/default.master"

    Property of "spweb.MasterUrl" is used to represent this token. It is most frequenet used Master page. We use the system master page for all forms and view pages in this site.

  2. Site Master Page

    Page language="C#" MasterPageFile="~masterurl/custom.master"

    Property of "spweb.CustomMasterUrl" is used to represent this token.The site master page will be used by all publishing pages

Although WSS 3.0 sites do not utilize the SPWeb.CustomMasterUrl property, MOSS 2007 publishing sites make heavy use of it. All page layouts are automatically configured to use the master page defined in the SPWeb.CustomMasterUrl property when rendering the site. The master page defined in SPWeb.MasterUrl property is till used for standard SharePoing Pages such as list or form pages.

WSS also supports two static master page tokens that start with either~site or~sitecollection. These static tokens allow you to hardcode a relative path to a master page from the root of either the current site or the current site collection. This allows you to create site page templates that point to a specific custom master page instance without requiring any code to perform redirection. For example, MasterPageFile="~sitecollection/_catalogs/masterpage/fred.master" refer to the root site of site collection's fred.master.

Application Page's Master Page

Application's Page refer to the page reside in the "~/_layouts" folder are served by the files in file systems. It is controlled independently from the content page. Default master page for application page is

MasterPageFile="~/_layouts/application.master"

No comments:

Post a Comment