Working with SharePoint Templates
page 1 of 2
Published: 25 Jan 2006
Unedited - Community Contributed
Abstract
In this article, you will learn how to create a SharePoint template to be used for sub areas, the important elements that need to be changed in the default.aspx page, important elements in Onet.xml, and also the folder structure for lists. In the end, we will discuss about some of the important elements included with the Schema.xml file.
by Ameet Phadnis
Feedback
Average Rating: 
Views (Total / Last 10 Days): 88727/ 78

Introduction

As a SharePoint Developer, often I am tasked with creating SharePoint Templates for sub areas. The clients would like to use these templates throughout the sub areas. At times the client requirements for SharePoint Templates can be as easy as creating only some extra Web Part Zones or even adding Web Part Zones to the header for images to be posted at a later stage. But sometimes, the clients might ask for some challenging templates to display multiple document libraries on the same page with default field names displayed. This article will try to clarify some of the concepts of how the SharePoint templates work.

With the help of this article, you will learn how to

1. Create a new template.

2. Add Web Part Zones to a template in default.aspx page.

3. Add Web Parts by default while create Sub Area Pages using Onet.xml.

4. Create default Content Lists using Onet.xml.

5. Create multiple lists of the same list type in Onet.xml.

6. Change the view using Schema.xml.

Folder Structure

Let's look at the folder structure and the key elements of a template. All the folders and files for SharePoint are located under C:\Program Files\Common Files\Microsoft Shared\web server extensions\60.

The templates for SharePoint are stored under C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033.

Please note that all the folders related to SharePoint start with SPS. The folder that starts with STS is for Windows SharePoint Services (WSS). The differences between SharePoint Portal and WSS are beyond the scope of this article.

The template information is stored under these folders. The explanation of the elements under this folder will be explained later. There is one more folder called xml folder. This folder contains various xml files. But the main important xml file which ties all the elements together is WEBTEMPSPS.xml. This file has all the information that relates the template to its respective folder. If you open this file you will notice the following.

WEBTEMPSPS.xml

<Template Name="SPSTOC"
ID="30">
  <Configuration ID="0"
Title="Contents area Template" Type="0"
Hidden="TRUE" 
    ImageUrl="../images/spshome.gif"
Description="Area Template.">
      <!--
_locID@Title="webtemp_title_spstoc0" 
        _locComment="{StringCategory=HTX}"
-->
      <!--
_locID@Description="webtemp_desc_spstoc0" 
        _locComment="{StringCategory=HTX}"
-->
  </Configuration>
</Template>    

The Name attribute in the Template represents the folder name.  In the above code, SPSTOC is the folder under which you will find all the files related to the Contents Area Template.

So, when you assign a template to be used on the Sub Area in the following screen, the dropdown list box is populating information from this XML file.

 

Figure 1

FYI: SharePoint will pull information regarding templates from the xml files starting with WEBTEMPSPS*.xml.

Once SharePoint is aware of all the templates that are installed on your server, it has all the necessary information regarding the folders to be used to design the template page. For example, if you have selected Contents Area Template then it is aware that the template is pointing to SPSTOC folder.

The SPSTOC folder has the following folders.

DOCTEMP - This folder stores the file templates to be used for Document Library Templates.

LISTS - The default lists provided by SharePoint.

XML - The XML files that are used to design the pages.

Detailed explanation of each and every folder is beyond the scope of this article. But, when we start looking at building our own template, I will highlight some files under these folders.

The default.aspx page is the page which will be displayed when some sub area is created using this template.

Under XML folder, you will notice that there is one file called Onet.xml. Onet.xml file will assist SharePoint with building the default.aspx page and the contents list initially. We will look into the Onet.xml file when we are building the template example.


View Entire Article

User Comments

Title: tHANKS   
Name: WALEED
Date: 2011-04-19 10:04:14 AM
Comment:
THANKS
Title: Great technique!   
Name: Anindo Mukherjee
Date: 2009-12-27 7:58:36 PM
Comment:
Great technique.
Title: Nice   
Name: Jelly
Date: 2008-08-14 3:14:20 AM
Comment:
This article is helpful...
but what if I want to fix the size of the document library web part displayed on the web page?...
Any ideas of how to do that?
Thanks.
Title: Very Nice Article   
Name: Chandrashekhar Bhadane
Date: 2007-10-31 8:51:11 AM
Comment:
HI!!!

Really this is very nice and useful articles for us

thank u very much
Title: Good Article   
Name: Joydeep Banerjee
Date: 2007-09-07 8:32:33 AM
Comment:
Good job.....
Title: Great Article   
Name: Kabir S.
Date: 2006-10-20 12:39:07 PM
Comment:
Hi!! This article is just great. Thanks a lot.
Title: Good Article   
Name: Jobita Alukka
Date: 2006-09-26 11:39:51 AM
Comment:
Very well written, and covers all the important points that you need to know. Helped me a lot with what I'm trying to do.

-Jobita
Title: Enable document library version option   
Name: Syed Adnan Ahmed
Date: 2006-09-21 10:06:36 AM
Comment:
Hi,

This is really an excellent article. I have to do something similar to that with one addition, which is, when user create new portal area by using new area template, versioning should be enable on all document libraries within that area.
I looked for internet to find any clue, but unsuccessfull. If would appreciate, if you can assist me on this issue.

Regards,
Syed Adnan Ahmed
SharePoint Consultant
Storm Technology
adnan@storm.ie
Title: Its useful artical   
Name: Mahendra Ghedia
Date: 2006-06-20 5:04:31 PM
Comment:
This argical is too good... it helped me a lot...
and the way of presentation is realy good anyone can understand easyly....

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2017 ASPAlliance.com  |  Page Processed at 2017-08-18 10:27:16 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search