将网页添加到空白共享点站点定义

发布于 2024-08-09 04:28:29 字数 485 浏览 11 评论 0原文

我对 Sharepoint (2007) 完全陌生,所以请耐心等待。我想在创建新站点时自动创建 aspx 页面。这些页面将通过由母版页定义的选项卡链接到。我没有自定义站点定义,并计划将功能装订应用于开箱即用的空白站点定义。

通过我的研究,我认为您可以创建一个 Web 部件页面并将其转变为一项功能。然后我可以将其钉到空白站点定义中。问题是我还没有找到任何有关如何执行此操作的信息。所以我有两个问题:

  1. 如何创建一个仅是 aspx 页面的功能?
  2. 如何将此功能钉到空白站点定义中?

我发现有人在这里问同样的问题: 如何将 Web 部件页面添加到网站定义? 我读了第一个回复,但它有点超出了我的理解,我不知道它是否真的回答了我的问题。

非常感谢!

I am totally new to Sharepoint (2007) so please bear with me. I would like to automatically create aspx pages when a new site is created. These pages will be linked to through tabs which will be defined by a master page. I do not have a custom site definition and was planning to apply feature stapling to the out of the box blank site definition.

Through my research, I think you can create a web part page and turn this into a feature. I can then staple this to the blank site definition. The problem is I haven't found any information on how to do this. So the two questions I have are:

  1. How do I create a feature that is just an aspx page?
  2. How do I staple this feature to a blank site definition?

I found one person asking the same question here: How to add a web part page to a site definition?
I read the first response but it sort of goes over my head and I don't know if it really answers my question.

Thanks so much!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随遇而安 2024-08-16 04:28:29

第一个问题的答案取决于您指的是应用程序页面还是内容页面。它们各有优点:应用程序页面很好,因为它们可以运行自定义服务器端代码,而内容页面很好,因为(例如)它们可以由用户自定义,但默认情况下限制可以运行哪种代码跑步。

有关这两种类型之间的功能和限制差异的详细讨论,请查看 Windows SharePoint Services SDK 并查看名为“应用程序布局页面类型" 和 "内容页面类型。"

至于装订,它比向站点定义的 onet.xml 文件添加新功能非常简单且更灵活。这篇文章似乎对替代方案做了很好的概述。不过,您可能想要复制空白站点定义,将其重命名,然后在您的工作中使用该副本。

内容页面的功能

为此,您需要三种类型的东西:

  1. feature.xml 文件——只是引用元素清单的样板文件。
  2. 页面模板——这可以是整个 aspx 页面本身,也可以是(例如)定义了 WebPartZones 但还没有实际 Web 部件的 Web 部件页面的外壳。
  3. 元素清单文件引用您的页面模板并定义应作为功能激活的一部分进行配置的任何 Web 部件。

您的功能的文件夹结构将如下所示:

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>

如果您以这种方式配置功能,您应该能够在该结构中部署网站内容页面。

另外,我强烈推荐 Ted Pattison 的Inside Windows SharePoint Services一书。它详细介绍了该主题,包括网站内容页面的重要安全方面。它很容易值得购买价格。

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

For a pretty good discussion on the differences between the two types in capabilities and restrictions, check out the Windows SharePoint Services SDK and look at the topics called "Application _layouts page type" and "Content page type."

As for stapling, it's pretty easy and more flexible than adding new features to a site definition's onet.xml file. This article seems a pretty good overview of the alternatives. You might want to make a copy of the blank site definition, rename it, and then use that one in your work, though.

Features with content pages

You'll need three types of things for this:

  1. A feature.xml file -- just the boilerplate stuff that refers to the element manifest.
  2. A page template -- this could be the entire aspx page itself, or it could be (for example) a shell of a web part page with WebPartZones defined but no actual web parts (yet).
  3. The element manifest file which refers to your page templates and defines any web parts that should be provisioned as part of activation of your feature.

Your feature's folder structure would 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 feature in that way, you should be able to deploy site content pages within that structure.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文