Customizing SharePoint Themes and Site Templates

SharePoint makes use of FrontPage Themes, but FrontPage doesn't make it easy to get at the files which make up a theme. First some background and then we'll look at how to get more control over building and deploying a theme.

When customizing a SharePoint template in FrontPage you access the available themes through the Format... Themes menu. This brings up the locally installed themes, which are stored in the c:\Documents and Settings\[username]\Application Data\Microsoft\Themes\ folder. Clicking a theme brings up options to Apply or Customize each theme. Customize is limited to a wizard UI, and walking through the stylesheet to update individual styles(Customize...Text...More Text Styles) is tedious work.

When you have a site open, the FrontPage IDE makes a _themes folder available, but this points to the actual web site folder so changes made here are not saved back to the local themes collection. What you need to do is edit the locally installed theme, not the files already applied to your website.

Each theme folder contains the following files: an ELM file, an INF file, and a UTF8 file. A PNG thumbnail might also be available. The ELM file is the package which contains the graphics and stylesheets for the theme. To unpack and repack these you will need to create a couple of VBS scripts which can be found in KB article FP2000: Unpacking and Repacking Files in FrontPage Themes.

After making a backup of your theme, unpack it with your new Unpack_elm.vbs script. From there you can use your favourite editor to search and replace items in the theme.css file, update graphics and their CSS references (like topgrad.gif and toolgrad.gif), whatever. During this stage it's helpful to have a reference handy for the WSS styles, I like the navigable visual reference at and the more detailed text reference on MSDN.

When done, repack with your new Repack_elm.vbs script and re-apply the theme to the site through FrontPage.

Now you've got a reusable Theme, let's move on to a reusable Site Template. Once you're done creating a Team Site just the way you want it, click to Site Settings...Go to Site Administration... and Save site as template. Fill in the blanks here and check the box labelled Include content to store Lists and Document Libraries as well. If successful, a link on the confirmation page will take you directly to the Site Template Gallery. Note that there is a 10Mb ceiling, so watch the size of those picture libraries.

In the Site Template Gallery, clicking on a name downloads that template as an STP file. As with InfoPath XSN files, a SharePoint STP file is just a CAB file with a new extension. Rename the file and you'll be able to unpack it and modify its contents. The rough part here is that SharePoint renames all the resources with great names like b1000000.000 and you will need to learn the format of the manifest.xml file before getting anywhere.

You can also delete templates in the Site Template Gallery, something you will want to do before creating a new template with content; this avoids storing templates inside templates. In fact, it's not a bad idea to delete a template once you've downloaded it, and keep all your standard templates in a single repository.

Better, you can install your new Site Template to be available from all team sites on the portal. There is an MSDN article which describes the process but we can break it down to a couple of steps. First, download the template and move it into a folder on the SharePoint server. Then from the command-line execute the following:

stsadm -o addtemplate -filename template.stp -title "My New Template" -description "My Template Description"

You can find stsadm.exe in C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN\

If it worked, you will see the message "Operation completed successfully." and a request to reset IIS. After executing iisreset.exe the new template will appear in the Template Selection page while creating a new site.

And that's all there is to it. Enjoy!

No Comments