Custom Site Templates
A custom template is a customization applied to a site or list definition. When a user with design rights customizes a Web site or list in the user interface or in a Web-editing application such as Microsoft Office SharePoint Designer 2007, and then saves the Web site or list as a template, the custom template consists of the difference between the original state of the Web site or list as determined by its definition, and the state of the Web site or list at the time that the custom template is generated.
In some ways, some site templates continue to depend, throughout their lifecycle, on the site definition that is their ultimate foundation. For this reason, Microsoft does not support changing or removing a site definition after sites have been created from it. Such changes may cause sites created from the definition (or created from site templates that are based on the site definition) to stop working properly or may prevent the creation of new sites based directly, or indirectly, on the site definition. See also Working with Site Templates and Definitions for more on the relation of site templates to site definitions. For more information on what kind of customizations of site definitions are supported by Microsoft, see Supported and unsupported scenarios for working with custom site definitions and custom area definitions in Windows SharePoint Services, in SharePoint Portal Server 2003, and in Office SharePoint Server 2007.
A custom template is persisted in the SharePoint database as a file with an .stp extension. The .stp file is stored in the Site Templates gallery or the List Templates gallery and includes one Manifest.xml file.
An .stp file is actually a .cab file. You can save a copy of the file from the Site (or List) Templates gallery, change the file extension from .stp to .cab and open the file in Windows Explorer.
List templates contain the files, views, fields, Web Parts, and, optionally, the content that is associated with a list. Users create list templates on the Save as Template page for a list, or through code that uses the SaveAsTemplate method of the Microsoft.SharePoint.SPList class. When saved, list templates are stored in the List Template gallery of the top-level site in a site collection. They are available to all sites in the site collection that derive from the same site definition and language as the site on which the list was originally created. To make a list template available to a site in another site collection, download the template from its current gallery and then upload it to the gallery of the new site collection.
Site templates contain the same type of data as list templates, but site templates include data for the entire site. Like list templates, site templates may also include the content of the site.
Users create site templates on the Save Site as Template page, or through code that uses the SaveAsTemplate method of the Microsoft.SharePoint.SPWeb class. When saved, site templates are stored in the Site Template gallery of the top-level site in a site collection, where they become available for subsite creation on all Web sites in the site collection.
Similar to list templates, site templates can be downloaded and moved to other site collection galleries. Unlike list templates, however, site templates can also be moved into the Central Site Template gallery, where they become available for top-level site creation in Self-Service Site Creation in addition to subsite creation.
To add a site template to the gallery from the command prompt
Download the site template from the gallery.
stsadm.exe -o addtemplate -filenameTemplate_File_Name
]at the command prompt from the
\\Program Files\Common Files\Microsoft Shared\web server extensions\12\BINdirectory.
Reset Internet Information Services (IIS) by typing
iisresetat the command prompt.
Site templates can include list templates. When a top-level site is saved as a template with content, it includes any list templates that are in the List Template gallery of the site collection.