Modify the default master page

Before you begin

When you first open a Windows SharePoint Services 3.0 site, a single default master page named Default.master is applied to all the pages in a site. You can modify this default master page for the whole site by using the design tools in Microsoft Office SharePoint Designer 2007. Modifying Default.master is the best option for you if this master page already meets most of your needs and you want to make only a few changes.

Top of Page Top of Page

Locate and copy Default.master

The default master page is located in the Master Page Gallery. In Office SharePoint Designer 2007, the Master Page Gallery is the masterpage folder, which is located in the _catalogs folder in the Folder List.

Default.master in the Folder List

Tip You can identify the name and location of the master page to which a content page is attached by viewing the master page indicator in the upper-right corner of the content page.

Path showing master page attached to the current page

It is a good idea to store any new master pages that you create in the same folder. That way, you can easily find and manage all of your master pages for the site in a single location.

It is also usually a good idea to create a copy of Default.master rather than modifying Default.master directly. However, if you do make changes directly to Default.master and are not satisfied with the changes that you have made, you can always reset Default.master to the site definition. For more information, see the article Reset a customized page to the site definition.

To create a copy of Default.master:

  1. In the Folder List, right-click Default.master, and then click Copy.
  2. Right-click the masterpage folder, and then click Paste.

Copy of the default master page in the Folder List

A new master page named default_copy(1).master appears. You can now modify and then rename this page. When you copy a master page, all content pages that are attached to the original master page — in this case, Default.master — remain attached to the original master page and not to the copy. After you copy and customize Default.master, you can apply it to all of the content pages in the site. For more information on how to apply the new master, see Apply the new master page.

Top of Page Top of Page

Identify and modify the styles

You can use the CSS tools in Office SharePoint Designer 2007 to identify the styles that are used on the master page and then modify those styles. For example, if you want to change the background color of the page, you first identify the styles where the background color is defined, and then change those styles to apply the background color that you want.

  1. Click the default_copy(1).master where you want to modify the style.

Note Some content areas that appear in Design view do not have styles applied to them, and therefore no corresponding style appears in the Apply Styles task pane. For example, if you select a content placeholder, no style appears in the Apply Styles task pane. Content placeholders, however, do appear inside HTML elements such as the tag.

  1. If the Apply Styles task pane is not visible, on the Task Panes menu, click Apply Styles.
  2. In the Apply Styles task pane, click Options, and then click Show Styles Used On Selection.

Each style applied to the area where the cursor is located is outlined in blue, and a preview of the style appears inside the outline.

In the following illustration, div.ms-titleareaframe is selected in Design view. In the Apply Styles task pane, three styles that are applied to div.ms-titleareaframe appear. The top style, Div.ms-titleareaframe, defines the background color.

Note Because styles are case-sensitive, the uppercase Div.ms-titleareaframe is different from the lowercase div.ms-titleareaframe.

Div.ms-titleareaframe selected in Design view displays the  corresponding style in the Apply Styles task pane

Callout 1 Div.ms-titleareaframe is selected in Design view.
Callout 2 The three styles applied to div.mstitleareaframe appear in the Apply Styles task pane.
  1. Right-click the style that you want to modify, and then click Select All X Instance(s), where X is the number of instances in which the style is applied on the page.

For this example, right-click the top style, Div.ms-titleareaframe.

  1. After you select all instances of the style, right-click the style again, and then click Modify Style.
  2. In the Modify Style dialog box, make the changes that you want, and then click OK.

To follow the example, in the Modify Style dialog box, under Category, click Background. In the background-color list, click RedRed, and then click OK.

The new style is applied to the page.

Modified style in Design view

Continue modifying the styles until the master page looks how you want it to.

Note If at any time you decide that you are not satisfied with the changes that you have made to the master page, you can reset it to the site definition. For more information, see the article Reset a customized page to the site definition.

When you modify a style in a SharePoint site, a local copy of Core.css is opened, and the changes are made to the local copy. For more information, see the article Apply a custom style sheet to a SharePoint site.

Top of Page Top of Page

Identify and modify the content placeholders

By default, most of the content on Default.master, the default master page for a Windows SharePoint Services 3.0 site, is not coded on the page. Much of the content comes from ASP.NET SharePoint Web controls, the content of which is retrieved from the server. When the content page is requested in the browser, this content is retrieved from the server and displayed on the page. For example, the text "Team Site" that appears in the leftmost region of the default home page (default.aspx) is supplied by an ASP.NET content placeholder control that retrieves the content from the server. The text "Team Site" does not appear inside HTML tags in Code view. You can replace this text with custom content by using Office SharePoint Designer 2007.

Most of the default content placeholders on Default.master are required for the collaboration features of Windows SharePoint Services 3.0 (such as SharePoint lists and libraries) and therefore should not be deleted. You can, however, use Office SharePoint Designer 2007 to modify the default content placeholders so that they look the way you want them to. For example, you can replace the text "Team Site" with other text.

  1. Open Default.master.
  2. To open the Master Page toolbar, on the View menu, point to Toolbars, and then click Master Page.
  3. Use the Master Page toolbar to locate the content placeholder that you want to modify.

To follow the example, on the Master Page toolbar, click the arrow to the right of the Region box, and then click PlaceHolderSiteName.

  1. Click the Team Site text to select the project property.

Project property inside the PlaceHolderSiteName content  placeholder selected in Design view

The project property inside the PlaceHolderSiteName content placeholder selected in Design view
  1. Type a new name for your site, and then save your changes by clicking Save on the File menu.

A message informs you that saving your changes will customize a page from the site definition. Click Yes.

Note If you are not satisfied with the changes that you have made to the master page, you can always reset it to the site definition. For more information, see the article Reset a customized page to the site definition.

For more information on how to locate and then modify the default content placeholders, see the article Modify the default SharePoint content placeholders.

Top of Page Top of Page

Add a new content region

You can also add a new content region to a master page by adding a content placeholder.

Note Content placeholders cannot be inserted inside other content placeholders.

  1. Right-click the page in Design view, and then click Manage Microsoft ASP.NET Content Regions on the shortcut menu.
  2. In the Manage Content Regions dialog box, in the Region name box, type a name for your new content region, and then click Add.

To follow the example, type ContentPlaceHolder1 in the Region name box.

  1. Click Close.

A new content placeholder, named ContentPlaceHolder1, appears.

Content placeholder in Design view

Note If you are not satisfied with the changes that you have made to the master page, you can always reset it to the site definition. For more information, see the article Reset a customized page to the site definition.

Top of Page Top of Page

Apply the new master page

After you create the new master page, you can make it the default master page for the entire site.

When you set a new master page as the default master page, all of the pages that are attached to the current version of Default.master, including the pages that already exist in your site as well as any new pages that you create that are attached to Default.master, will be attached to the the new master page.

  • In the masterpage folder, right-click the page that you want to use as the new default master, and then click Set as Default Master Page on the shortcut menu.

A message appears warning you that any pages that contain content regions that do not appear in the new default master page will appear broken. If the content regions in the new default master match the content regions in the site's content pages, click Yes. For more information on content regions and content placeholders, see the article Modify the default SharePoint content placeholders.

Note If the master page is already the default master page for the site, the Set as Default Master Page command is unavailable.

source:office.microsoft.com

0 nhận xét:

Post a Comment

thanks comment