Add a web page to free space detection in sharepoint

I am completely new to Sharepoint (2007), so please bear with me. I would like to automatically generate aspx pages when creating a new site. These pages will be associated with tabs that will be defined by the home page. I don't have a custom site definition and was planning on applying feature stitching to a blank site page definition.

Through my research, I think you can create a web part page and turn that into a function. I can then stitch this together with a blank page definition. The problem is I haven't found any information on how to do this. So, I have two questions:

  • How do I create a function that is just an aspx page?
  • How do I copy this functionality into an empty site definition?

I found one person asking the same question: How do I add a web part page to a site definition? I read the first answer, but it looks like my head and I don't know if this really answers my question.

Many thanks!

+1


source to share


1 answer


The answer to your first question depends on whether you have app pages or content pages . They each have their advantages: application pages are good because they can run their own server-side code, and content pages are good because (for example) they can be customized by users, but by default are limited in what code can run.

For a pretty good discussion of the differences between the two types of capabilities and limitations, browse the Windows SharePoint Services SDK and look at the topics called Application _layouts page type and " Content page type ."

As far as stitching is concerned, it is quite easy and flexible than adding new functionality to the onet.xml site definition file. This article seems like a pretty good overview of the alternatives. You might want to make a copy of the empty space definition, rename it, and then use it in your work.

Functions with content

To do this, you need three types of things:

  • The feature.xml file is just the template material that references the item manifest.
  • Page Template - This could be the aspx page itself, or it could (for example) wrap a web part page with WebPartZones

    but not actual web parts (yet).
  • An element manifest file that links to your page templates and defines any web parts that should be exposed as part of your feature activation.

Your function's folder structure will look something like this:

12
+-- TEMPLATES
    +-- FEATURES
        +-- YourFeature
            +-- PageTemplates
            |   +-- Page.aspx (simple aspx page)
            |   +-- WebPartPage.aspx (still simple, but with WebPartZones)
            +-- feature.xml
            +-- elements.xml

      

Feature.xml:



<Feature 
  Id="CFF117BC-9685-4a7b-88D0-523D9DAD21F0"
  Title="Custom Pages Feature"
  Scope="Web"
  xmlns="http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest Location="elements.xml"/>
  </ElementManifests>
</Feature>

      

Elements.xml

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Path="PageTemplates" Url="Pages" >
    <File Url="Page.aspx" Type="Ghostable" />
    <File Url="WebPartPage.aspx" Name="WebPartPage.aspx" Type="Ghostable" >
      <AllUsersWebPart WebPartZoneID="Left" WebPartOrder="0">
        <![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>Some content that you want to provision with the feature</Title>
                <FrameType>TitleBarOnly</FrameType>
                <cewp:Content>
                  Hello world.
                </cewp:Content>
            </WebPart>
        ]]>
      </AllUsersWebPart>
    </File>
  </Module>
</Elements>

      

Page.aspx

<%@ Page MasterPageFile="~masterurl/default.master" 
    meta:progid="SharePoint.WebPartPage.Document"  %>
<asp:Content runat="server" ContentPlaceHolderID="PlaceHolderMain">
  Hello World
</asp:Content>

      

WebPartPage.aspx

<%@ Page Language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document"   %>

<%@ Register Tagprefix="WebPartPages" 
             Namespace="Microsoft.SharePoint.WebPartPages" 
             Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<asp:Content ID="main" runat="server" ContentPlaceHolderID="PlaceHolderMain" >

<table width="100%">
  <tr>
    <td valign="top" style="width:50%">
        <WebPartPages:WebPartZone ID="Left" runat="server" 
                      FrameType="TitleBarOnly" Title="Left Web Part Zone" />
    </td>
    <td valign="top" style="width:50%">
        <WebPartPages:WebPartZone ID="Right" runat="server" 
                     FrameType="TitleBarOnly" Title="Right Web Part Zone" />        
    </td>
  </tr>
</table>

</asp:Content>

      

If you configure your function this way, you will be able to deploy the site content pages in this structure.

Also, I highly recommend the book Ted Pattison Inside Windows SharePoint Services . He describes this topic in detail, including important aspects of the security of the site's content pages. It's easily worth the purchase price.

+6


source







All Articles