Friday, March 8, 2013

create default home page and add webparts on sitedefinition


11-      Create home.aspx page bye adding textfile and change extension .aspx
22-      Open home.aspx and write magic code :

 <%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %> <%@ Reference VirtualPath="~TemplatePageUrl" %> <%@ Reference VirtualPath="~masterurl/default.master" %>

33-  Open onet.xml and add these lines
 <Modules>    <Module Name="DefaultBlank" Url="Pages" Path="">
      <File Url="Home.aspx"  Path="Home.aspx" Type="GhostableInLibrary">
        <Property Name="Title" Value="Home" />
        <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/HomeLayout.aspx, Home Default Layout" />
        <Property Name="ContentType" Value="myPagesCT" />
        <AllUsersWebPart WebPartZoneID="myWebpart" WebPartOrder="1">
          <![CDATA[

<!—your webpart code à]]>        </AllUsersWebPart>
</File></Module></Modules>

No comments:

Post a Comment