in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Tobias Zimmergren's thoughts on development - MOVED!

THIS BLOG HAS MOVED!!!
NEW URL: www.zimmergren.net
Please update your RSS and bookmarks!

Any comments here will not be answered, please comment on http://www.zimmergren.net instead!
All the same posts are there

Creating a custom Master Page for your MOSS 2007 portals and sites

When I first started discovering Master pages I didn't know where to start and what would be needed in order for a basic and as minimalistic master page as possible to work.
I gathered information to be able to make myself a minimal masterpage which would be the startingpoint of my upcoming customizations and changes.
At first nothing worked, and since there's no good list of what elements and contentplaceholders are needed for a masterpage to work it had to do with a lot of "trial-and-error" until I finally had a completely working basic master page.
With the help of google and some other sites around the web I noted which placeholders showed up on every master page.
Below you will see the code for a very very basic master page, in which you can insert your own custom html-tags and assign a css-theme later to make your customizations a reality.
With this small template, you can make all your existing static designs work as a master page if you just put a little time and effort into it.
######### Page file starts here ############
<%@ Master language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" src="~/_controltemplates/DesignModeConsole.ascx" %>
<%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %>
<%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %>
<%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" src="~/_controltemplates/PublishingActionMenu.ascx" %>
<html>
<WebPartPages:SPWebPartManager runat="server"/>
<SharePoint:RobotsMetaTag runat="server"/>
<head runat="server">
<asp:ContentPlaceHolder runat="server" id="head">
<title>
<asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server" />
</title>
</asp:ContentPlaceHolder>
<Sharepoint:CssLink runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server" />
</head>
<body onload="BLOCKED SCRIPT_spBodyOnLoadWrapper();">
<form runat="server" onsubmit="return _spFormOnSubmitWrapper();">
<wssuc:Welcome id="explitLogout" runat="server"/>
<PublishingSiteAction:SiteActionMenu runat="server"/>
<PublishingWebControls:AuthoringContainer id="authoringcontrols" runat="server">
<PublishingConsole:Console runat="server" />
</PublishingWebControls:AuthoringContainer>
<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" />
<asp:Panel visible="false" runat="server">
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderPageImage" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderBodyLeftBorder" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderNavSpacer" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderTitleLeftBorder" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderTitleAreaSeparator" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderMiniConsole" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat ="server" />
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat ="server"/>
</asp:Panel>
</form>
</body>
</html>
######### Page file ends here ############
As you can see there's a javascript method in the body-tag called SpBodyOnLoadWrapper. This class is automatically loaded by MOSS 2007 and handles javascript calls.

SPWebPartManager is needed for functionality and events to work as desired. Also handles web part controls if I'm not mistaken.
The PlaceHolderMain placeholder is the placeholder that contains the page content and what not. Still unsure on the details about these placeholders, so bear with me will you.
The contentplaceholders within the <asp:panel>-block are nessesary to maintain full out-of-the-box functionality for pages to work with your own defined masterpage.
I hope this will guide you in the right direction as to starting with master page-customization. The possibilites are endless but time isn't, therefore you can without any problems just copy/paste the above code and it should work wonders right away.

Comments

 

isitreallyrequired said:

that is absolutely meaningless

September 3, 2007 8:14 AM
 

Tobias Zimmergren said:

If you would have read the "Published" date for this post, you would see that it's about one year old, and back then it was a bit more useful than now.

September 3, 2007 8:57 AM
 

Jayanth said:

I want to add a menu item in sharepoint 2007. If you open the sharepoint home page you can see the webparts available there. If you click document library link it will take you to the respective page. There you can see list of documents under related documents. If you click any document it will show a combobox with options as view properties, edit properties, manage permissions, edit in Microsoft office word, delete, sent to option as other location, e-mail a link, create document workspace, and download a copy. Here in this send to menu I want to add another item called Fax. I want to do this in C# 2.0. Should I create web application or website for this? How to do this? Please help me.

October 24, 2007 5:11 AM
 

Tobias Zimmergren said:

Hi Jaynath,

You can ofcourse create a Feature that will add the menuoption for sending it via Fax.

How did you plan on solving the actual application for sending the fax? Do you have an existing solution for sending faxes, or want to create one?

What resourses do you have at hand?

Cheers

October 24, 2007 12:02 PM

Leave a Comment

(required )  
(optional )
(required )  
Add

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts