gpt4 book ai didi

sharepoint - 在 SP2010 中部署基于自定义布局的页面

转载 作者:行者123 更新时间:2023-12-01 11:45:44 25 4
gpt4 key购买 nike

我能够成功部署自定义页面布局并在母版页库中看到它。我还可以从此布局手动创建页面。

我想做的是在我的网站定义中有一个页面,该页面基于随包自动部署的自定义布局。

如何部署页面并告诉该页面使用哪种布局?

最佳答案

使用模块,您可以从 PageLayout 创建 Page 实例

我猜你的 PageLayouts PageName 是 Home.aspx 而实例名称应该是 Home.aspx

希望您的页面布局上传到 _catalogs/masterpage 目录。

 <Module Name="PagesLayouts"
Url="_catalogs/masterpage"
Path=""
RootWebOnly="False">
<File Url="YourModuleName/Home.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE"></File>
</Module>

比:

<Module Name="CustomPages" Url="Pages" Path="" RootWebOnly="FALSE">
<File Name="Home.aspx" Url="Home.aspx" Type="GhostableInLibrary" Path="Home.aspx" IgnoreIfAlreadyExists="TRUE">
<Property Name="Title" Value="Home" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/Home.aspx" />
<Property Name="ContentType" Value="Page" />
</File>
</Module>

请看这里:http://kamilmka.wordpress.com/2011/03/30/create-sharepoint-page-instance-from-a-feature/

更新:

我刚刚创建了演示项目以便正确理解。你可以看到我的解决方案结构。刚刚添加了一个模块名称是PageLayouts,并放了一个PageLayout Page。

enter image description here

我使用的模块的完整 Element.xml 文件:

 <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="PageLayouts" Url="_catalogs/masterpage" Path="" RootWebOnly="TRUE">
<File Path="PageLayouts\CustomPageLayouts.aspx" Url="CustomPageLayouts.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE">
<Property Name="Title" Value="Custom General Page" />
<Property Name="MasterPageDescription" Value="Custom General page layout" />
<Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" />
<Property Name="PublishingPreviewImage" Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/WelcomeSplash.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/WelcomeSplash.png" />
<Property Name="PublishingAssociatedContentType" Value=";#$Resources:cmscore,contenttype_welcomepage_name;;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064DEA0F50FC8C147B0B6EA0636C4A7D4;#" />
</File>
</Module>
<!--Create Page instance from Page layouts of CustomPageLayouts.aspx-->
<Module Name="CustomPages" Url="Pages" Path="" RootWebOnly="FALSE">
<File Name="Home.aspx" Url="Home.aspx" Type="GhostableInLibrary" Path="PageLayouts\CustomPageLayouts.aspx" IgnoreIfAlreadyExists="TRUE">
<Property Name="Title" Value="Home" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/CustomPageLayouts.aspx"/>
<Property Name="ContentType" Value="Page" />
</File>
</Module>

希望对您有所帮助!

关于sharepoint - 在 SP2010 中部署基于自定义布局的页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15541685/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com