WEBTEMP.XML and Its Derivatives


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

 <Templates xmlns:ows="Microsoft SharePoint">   <Template Name="STS" >     <Configuration  Title="Team Site" Hidden="FALSE"       ImageUrl="/_layouts/images/stsprev.png"       Description="This template creates a site for teams to create,                  organize, and share information quickly and easily.                  It includes a Document Library, and basic lists                  such as Announcements, Events, Contacts, and Quick                  Links.">     </Configuration>     <Configuration  Title="Blank Site" Hidden="FALSE"       ImageUrl="/_layouts/images/stsprev.png"       Description="This template creates a Windows SharePoint                  Services-enabled Web site with a blank home page.                  You can use a Windows SharePoint Services-compatible                  Web page editor to add interactive lists or any                  other Windows SharePoint Services features.">     </Configuration>     <Configuration  Title="Document Workspace" Hidden="FALSE"       ImageUrl="/_layouts/images/dwsprev.png"       Description="This template creates a site for colleagues to                  work together on documents. It provides a document                  library for storing the primary document and                  supporting files, a Task list for assigning to-do                  items, and a Links list for resources related to                  the document.">     </Configuration>   </Template> . . . 

Table 2.2. <Template> Attributes

Attribute

Required

Type

Description

ID

Yes

Integer

This specifies a unique key for the site definition. Every template key must be unique among all the keys specified in WEBTEMP.XML and WEBTEMP.xml. To avoid conflict with site definitions provided by Microsoft, the key must be greater than 10,000.

Name

Yes

Text

The folder name for the site definition. The folder is expected to exist at the same level as STS, MPS, and XML.


Table 2.3. <Configuration> Attributes

Attribute

Required

Type

Description

Description

No

Text

Specifies the description of the site definition template that appears immediately below the ImageUrl of the Template Selection (TemplatePick.aspx) page.

Hidden

No

Boolean

Determines whether the site definition template should be hidden from the Template Selection options.

ID

Yes

Integer

This represents a key unique to all its siblings in a particular <Template> element. As described in the next section, it is then matched to the ID specified in ONET.XML to determine the template within the site definition.

ImageUrl

No

Text

This is the image that is shown on the Template Section page. This appears above the description.

Name

No

Text

Internally referenced name of the site definition template.

Title

No

Text

The title of the site definition template to be shown in the selection box on the Template Selection page.

Type

No

Text

Identifies the configuration with a specific site definition.


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 Definition

Creating 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

 <?xml version="1.0" encoding="utf-8"?> <Templates xmlns:ows="Microsoft SharePoint">   <Template Name="MyFirstSiteDefinition" ID="10001">     <Configuration ID="10"       Title="My First Site Definition Team Site"       Hidden="FALSE"       ImageUrl="/_layouts/images/stsprev.png"       Description="This is my first site definition.">     </Configuration>   </Template> </Templates> 

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.





SharePoint 2003 Advanced Concepts. Site Definitions, Custom Templates, and Global Customizations
SharePoint 2003 Advanced Concepts: Site Definitions, Custom Templates, and Global Customizations
ISBN: 0321336615
EAN: 2147483647
Year: 2006
Pages: 64

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net