I've just started to play around with Site Definitions. I was forced into it, because I need to create a template for a Portal Area, and that is the only option available to me. But now I can really see the power of them. Once you get used to them, you can do so much. I always wondered how I could create my own custom view, and now I know.
My main tool at this stage is FrontPage to edit the XML, and the SharePoint SDK to find out what each of the tags really means. There is quite a lot of trial and error at these early stages, but results are being reaped. My current little problem is that I have defined a document library, in my site definition. It gets created when I create a new area using my template. All fine. But if I try to create a web part page, I cannot save it to this document library! My library doesn't show up in the dropdown list of locations that I can store my new page. Strange.
If I add a new DL after the area has been created, I can save it there.
Update: To resolve this issue, I needed to upate the following file:
Common files\Microsoft Shared\Web Server Extensions\60\Template\Layouts\1033\spcf.aspx
Here is the original condition in the code:
if ((!spList.Hidden) && (spList.BaseType == SPBaseType.DocumentLibrary) && (spList.BaseTemplate == SPListTemplateType.DocumentLibrary))
I modified the condition to also include the TemplateID for my custom document library (200):
if ( ((!spList.Hidden) && ((spList.BaseType == SPBaseType.DocumentLibrary) ((int)spList.BaseType == 200))) && ((spList.BaseTemplate == SPListTemplateType.DocumentLibrary) ((int)spList.BaseTemplate == 200)) )
Too easy! So the problem really is that by default, SharePoint only lets you save web part pages to document libraries with a base template type of SPListTemplateType.DocumentLibrary. Therefore, if you are defining your own document library as part of your site definition, and you want to easily create web part pages in it, you will have to do a similar update.