The default Windows SharePoint Services (WSS) site definition templates (Team Site, Blank Site, Document Workspace, Basic Meeting Workspace, Blank Meeting Workspace, Decision Meeting Workspace, Social Meeting Workspace, and Multipage Meeting Workspace) were listed in Figure 1.1. SharePoint parses WEBTEMP.XML and any other files matching the pattern WEBTEMP.XML (such as WEBTEMPMyFirstSiteDefinition.XML) to compile the list of available site definitions. The eight default Microsoft site definitions are listed in WEBTEMP.XML. SharePoint Portal Server also employs the WEBTEMP metaphor for listing its site definition templates. SharePoint Portal Server's WEBTEMP is named WEBTEMPSPS.XML. It references the home, topics, news, site directory, my site, contents, and a few other templates. These site definition templates work in exactly the same way that Windows SharePoint Services site definition templates function. Thus, when you understand how to customize WSS site definitions, you will also understand how to customize SharePoint Portal Site definitions. The only caveat to Portal Area Templates (site definitions) is that the folder name housing your Portal Site definition must begin with SPS. WEBTEMP.XML and its derivatives are found in the XML configuration folder C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\XML. The default WSS WEBTEMP.XML is shown in Listing 2.1. It is composed of CAML defined elements. Each Template element maps to a particular site definition folder. The Configuration element represents a particular template (flavor) for that site definition. Both nodes are described more fully in Table 2.2 and Table 2.3. Listing 2.1. WSS Default WEBTEMP.XML
The WEBTEMP.XML mechanism provides a way to add separate customizations without affecting any existing site definitions. Additionally, it is a good practice to name your WEBTEMP file with respect to your site definitionsuch as WEBTEMPMyFirstSiteDefinition.XML. Creating a New Site DefinitionCreating a new site definition is as simple as copying a folder and creating a new WEBTEMP file. Create the file WEBTEMPMyFirstSiteDefinition.XML in the folder C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\XML (see Figure 2.1). Copy the contents of Listing 2.2 into this newly created file. Listing 2.2. WebTempMyFirstSiteDefinition.XML Contents
Figure 2.1. XML folder Explorer view.The CAML definitions for the Template and Configuration elements are defined in the previous tables. The Name attribute within the Template node (Template/@Name) specifies the folder where the site definition can be found. Template/@ID specifies the flavor of the site definitionmore specifically, it specifies the site definition template. The various site definition templates are defined within the ONET.XML file packaged within the site definition. The next step in creating a custom site definition is to make a copy of a site definition after which you want to pattern yours. In our example, we want to pattern our site definition after the team site. Therefore, copy the STS folder and name it MyFirstSiteDefinition. Remember, both folders are children of C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033 (see Figure 2.2). Figure 2.2. 1033 Explorer view.The first time a SharePoint page is requested, the application pool creates an instance of SharePoint, and site definitions are read. To see new site definitions, you must force a restart of SharePoint by running IISReset.EXE or rebooting the server. The new site definitions will appear the next time you apply a template to a site (see Figure 2.3). Figure 2.3. New site definition templates appear after creating the WEBTEMP file. |