When you provision sites you can provide various pages (normal pages, not just publishing ones!) However, what if you want to put web parts onto those pages?
Well, you could build multiple pages for your different site configurations. Or you could use a feature receiver to add it programmatically. Or, you could add it via your site configuration.
This is what I found myself doing with the Content Editor web part – I wanted to build it into my site definiton:
<Module Name="CaseSite" Url="" Path="">
<File Url="default.aspx" NavBarHome="True" Type="Ghostable">
<AllUsersWebPart WebPartZoneID="Right" WebPartOrder="1">
<![CDATA[
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" xmlns:cewp="http://schemas.microsoft.com/WebPart/v2/ContentEditor">
<Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
<Title>Structral Site Text</Title>
<FrameType>None</FrameType>
<cewp:Content>This is a Case Site</cewp:Content>
</WebPart>
]]>
</AllUsersWebPart>
</File>
</Module>
Here you can see a module deploying a page (default.aspx) and specifying a web part to go at the top of the ‘Right’ web part zone. The XML defines the web part assembly and type, and the content goes into the <cewp:Content> tag.
Works nicely – next step, doing this with custom web parts.
Hi!
I am not able to include multiline contents (may be with html tags) into tag. But able to add only plain single line of text…
Please tell me how to achieve that.
Thanks…
Your contents are HTML, so you should use tags, or possibly tags to start new paragraphs/lines.