Working with Master Pages in SharePoint
Master pages are reusable page templates which use a combination of ASP.NET controls and HTML markup. Once a user creates a new Publishing page, that page’s look and feel derives from a master page; the content to be displayed the content’s layout comes from the page layout; and the content itself comes from the Publishing page instance which is created by the author. Thus, master pages, page layouts, and page instances create a hierarchical page model which separates the presentation from the content. Master pages and page layouts are kept in a dedicated document library called the Master Page gallery. Each site collection has a single Master Page gallery for its entire site collection which can be accessed from the top-level site’s Site Settings page.
A master page can be created from scratch or copied from an existing page and then edited. Initially it would be most convenient to copy and edit an existing master page. You will normally use a visual design tool, such as SharePoint Designer or Visual Studio , to edit and create master pages (note that you can download a free version of Visual Studio – Visual Web Developer from http://msdn.microsoft.com/vstudio/express/vwd).Master page file names must end with the file extension .master.
There are currently nine master pages in the Master Page gallery. Since the Master Page gallery is a document library, you may check out or upload a master page in the same manner you woulda Word document or any other file.
When a master page is opened, you see text that is actually a of HTML and ASP.NET , and importantly contains a series of ASP.NET placeholders. These placeholders are used to display the elements which will be displayed on every page which inherits from the master page, these elements will typically be page features such as navigation, search, or the footer. The content from the page layout is populated in the PlaceHolderMain. The code looks like this:
<asp:ContentPlaceHolder id=”PlaceHolderMain” runat=”server” />
Master pages normally link to Cascading Style Sheets (CSS) files, which defines the styles used to control the look and feel of the page. The CSS files which are used with master pages are stored in the Style library at the top-level site of a site collection. Master Pages are a an ASP.NET technology and so for a detailed tutorial of how master pages work and how to use them please see Master Pages – A Beginners Guide
To easily change the look of a page it is a simple process to change the master page associated with a site. Of the nine master pages included in MOSS 2007, all except BlueVertical.master and BlackVertical.master will work for internal SharePoint sites, these two master pages should only be used with Internet-facing sites.
To change the master page associated with a site, do the following:
- Navigate to the Site Settings page for the relevant site.
- Select Master Page in the Look and Feel section, and the Site Master Page Settings page will appear.
- Under Site Master Page, select the master page to be used for all the Publishing pages in the site.
- Under System Master Page , select the master page to be used for all the forms and view pages in the site.
- For the Alternate CSS URL, select whether the site should use the default or custom CSS settings.
- Click OK and the process is complete, and master pages are applied to the site.
If you use different master pages for Publishing and System pages, you can maintain one look for the Publishing pages while keeping the classic SharePoint look for default SharePoint pages like document libraries.
Continues…
Pages: 1 2
Array



