2013-03-15 80 views
0

在SharePoint 2013中,可以使用新的设计管理器创建母版页和页面布局。在将HTML文件转换为母版页之后,或者在创建新的页面布局之后,可以使用片段管理器添加SharePoint功能。我已经使用这种方法将一个静态的HTML/CSS文件转换成带有附带页面布局的SharePoint主页面。我可以使用片段管理器中的所有片段,但“内容编辑器”片段除外。我能够添加顶部导航,快速启动栏,页面属性以及“Web部件区域”片段。SharePoint 2013无法编辑内容编辑器代码段

用例:
我想要一个可编辑的页脚。页脚由四部分组成,因此我添加了四个内容编辑器片段,方法是将片段代码粘贴到HTML主页面中。生成片段时,可以设置自定义属性。我注意到在这里设置WebPartID是不可能的。在代码片段中,总是使用以下WebPartID:00000000-0000-0000-0000-000000000000。然而,“Web Part Zone”片段将生成一个(随机?)WebPartID(并且工作)。

问题:
添加段工作正常,但是当我发布的母版页或页面布局这是不可能的编辑CEWP。编辑使用母版页或页面布局的页面时,CEWP应转换为可编辑区域,但不能。没有显示错误。 webpart呈现正确。

我的尝试:
我想在一个随机WebPartID填充,但不起作用。在谷歌和StackOverflow上搜索没有给我任何线索,我找不到任何人面临同样的问题。

的代码:生成
下面的代码片断:

<!--CS: Start Content Editor Snippet--><!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>--><!--MS:<WebPartPages:ContentEditorWebPart xmlns:WebPartPages="namespace" runat="server" webpart="true">--><!--PS: Start of READ-ONLY PREVIEW (do not modify)--><div class="ms-webpart-chrome ms-webpart-chrome-fullWidth "><div WebPartID="00000000-0000-0000-0000-000000000000" HasPers="true" id="WebPart" width="100%" class="ms-WPBody noindex " OnlyForMePart="true" allowMinimize="false" allowRemove="false" allowDelete="false" style=""><div class="ms-rtestate-field"></div><div class="ms-clear"></div></div></div><!--PE: End of READ-ONLY PREVIEW--><!--MS:<WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2">--><!--MS:<Title>--><!--SPM:$Resources:core,ContentEditorWebPartTitle;--><!--ME:</Title>--><!--MS:<FrameType>--><!--SPM:None--><!--ME:</FrameType>--><!--MS:<Description>--><!--SPM:$Resources:core,ContentEditorWebPartDescription;--><!--ME:</Description>--><!--MS:<IsIncluded>--><!--SPM:true--><!--ME:</IsIncluded>--><!--MS:<ZoneID>--><!--SPM:ImportedPartZone--><!--ME:</ZoneID>--><!--MS:<PartOrder>--><!--SPM:0--><!--ME:</PartOrder>--><!--MS:<FrameState>--><!--SPM:Normal--><!--ME:</FrameState>--><!--MS:<Height>--><!--ME:</Height>--><!--MS:<Width>--><!--ME:</Width>--><!--MS:<AllowRemove>--><!--SPM:false--><!--ME:</AllowRemove>--><!--MS:<AllowZoneChange>--><!--SPM:false--><!--ME:</AllowZoneChange>--><!--MS:<AllowMinimize>--><!--SPM:false--><!--ME:</AllowMinimize>--><!--MS:<AllowConnect>--><!--SPM:true--><!--ME:</AllowConnect>--><!--MS:<AllowEdit>--><!--SPM:true--><!--ME:</AllowEdit>--><!--MS:<AllowHide>--><!--SPM:false--><!--ME:</AllowHide>--><!--MS:<IsVisible>--><!--SPM:true--><!--ME:</IsVisible>--><!--MS:<DetailLink>--><!--ME:</DetailLink>--><!--MS:<HelpLink>--><!--ME:</HelpLink>--><!--MS:<HelpMode>--><!--SPM:Modeless--><!--ME:</HelpMode>--><!--MS:<Dir>--><!--SPM:Default--><!--ME:</Dir>--><!--MS:<PartImageSmall>--><!--ME:</PartImageSmall>--><!--MS:<MissingAssembly>--><!--SPM:Cannot import this Web Part.--><!--ME:</MissingAssembly>--><!--MS:<PartImageLarge>--><!--SPM:/_layouts/15/images/mscontl.gif--><!--ME:</PartImageLarge>--><!--MS:<IsIncludedFilter>--><!--ME:</IsIncludedFilter>--><!--MS:<ExportControlledProperties>--><!--SPM:true--><!--ME:</ExportControlledProperties>--><!--MS:<ConnectionID>--><!--SPM:00000000-0000-0000-0000-000000000000--><!--ME:</ConnectionID>--><!--MS:<ID>--><!--SPM:g_2bfa6a66_54d1_45e6_84e7_ebbb461f2911--><!--ME:</ID>--><!--MS:<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</ContentLink>--><!--MS:<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</Content>--><!--MS:<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</PartStorage>--><!--MS:<ID>--><!--SPM:g_a4deccb6_9661_415d_99c8_51f528cf7428--><!--ME:</ID>--><!--ME:</WebPart>--><!--ME:</WebPartPages:ContentEditorWebPart>--><!--CE: End Content Editor Snippet--> 

由此,在文件名为.master以下代码:

<WebPartPages:ContentEditorWebPart runat="server" webpart="true" __WebPartId="{B2063517-7C26-4084-AA28-36434C760CDB}"><WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"><Title>$Resources:core,ContentEditorWebPartTitle;</Title><FrameType>None</FrameType><Description>$Resources:core,ContentEditorWebPartDescription;</Description><IsIncluded>true</IsIncluded><PartOrder>0</PartOrder><FrameState>Normal</FrameState><Height /><Width /><AllowRemove>false</AllowRemove><AllowZoneChange>false</AllowZoneChange><AllowMinimize>false</AllowMinimize><AllowConnect>true</AllowConnect><AllowEdit>true</AllowEdit><AllowHide>false</AllowHide><IsVisible>true</IsVisible><DetailLink /><HelpLink /><HelpMode>Modeless</HelpMode><Dir>Default</Dir><PartImageSmall /><MissingAssembly>Cannot import this Web Part.</MissingAssembly><PartImageLarge>/_layouts/15/images/mscontl.gif</PartImageLarge><IsIncludedFilter /><ExportControlledProperties>true</ExportControlledProperties><ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID><ID>g_2bfa6a66_54d1_45e6_84e7_ebbb461f2911</ID><ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" /> 
<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"><![CDATA[]]></Content> 
<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" /><ID>g_a4deccb6_9661_415d_99c8_51f528cf7428</ID></WebPart></WebPartPages:ContentEditorWebPart> 

一些更多的信息
如图所示,我正在将HTML片段粘贴到HTML文件中。当我添加Web部件区片段时,我可以在其中添加工作的“内容编辑器”WebParts。 “Web部件区域”片段仅在页面布局片段管理器中可用,所以我不能将其用作解决方案以使主页中的页脚正常工作。

我的问题:

  1. 我如何通过段管理器中添加内容编辑器Web部件?
  2. 有其他人面临同样的问题吗?
  3. 可以离开WebPartID 00000000-0000-0000-0000-000000000000吗?
+0

你解决了这个问题吗? – 2013-12-05 17:40:48

+0

不,我无法花更多时间在它上面。我们最终没有对页脚进行修改(这对业务是可以接受的,因为内容不会经常更改)。如果有人发现此问题的解决方法,请分享。 – Arjan 2014-03-14 12:23:14

回答

1

已经打了一下与SharePoint这一点,这是我发现:

有两种不同的方式片段由段管理器创建工作。如果将它们放在主页面或页面布局的HTML代码中的任何位置,它们将具有与在代码段编辑器上选择的配置完全相同的配置,并且之后您将无法对其进行编辑。

但是,如果将它们放入Webpart容器代码片段中,则可以在访问SharePoint上的编辑页面功能时编辑Web部件。正如你可能知道的那样,这只适用于页面布局,而不适用于主页面。

我相信有一个动态页脚的方法,就是使用Content Search Web部件并将其指向特定列表(页脚列表),并在该列表中可以使用富文本编辑器类型的列,然后您可以创建一个特定的显示模板,根据需要呈现列表内容。

希望它有道理。

+0

感谢您分享您的想法,确认问题并提供可行的解决方法。我标记为答案,因为它似乎无法让母版页上的内容编辑器代码段工作。解决这个问题是完成这项工作的一个很好的选择。谢谢! – Arjan 2014-03-15 12:45:12