3

I've created a MOSS 2007 SharePoint site definition for my users, and now want to use a custom default.aspx page as a landing page every time a new site using that definition is created. That default web page needs to display some web parts pointing to site relative data e.g. I want it to display some documents from a local document library on the site.

I've opened a site in SPD and modified the current default.aspx page by adding a web part pointing to the document library. However, the links in the code point to the library on the site I'm looking at in SPD. How do I save this page as a template so that it points to the local library whenever it gets deployed to a new site? Is that even the right way to do it?

I've got the core publishing feature activated if that helps, although this is not a publishing site so doesn't have the full range of publishing options.

1 Answer 1

1

You'd do this using a feature. Save the page to your machine, then create a solution using Visual Studio (and say WSPBuilder) that deploys the page to your site. It'll overwrite the existing page. The only problem is that most standard webparts reference lists using their id (a Guid), so you'd need a way to circumvent this. I usually do this by adding a feature receiver to the feature, which allows you to use the SharePoint Object model to perform actions in code.

P.S. more info here: http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/5d0ae15c-fa2e-41b1-86f4-ce208b88c9b6

1
  • Thanks Colin, that seemed to be the only option open to me, but I'm glad to have it confirmed before I go down that route.
    – Gerry
    Commented Jun 22, 2011 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.