0

I want to to prelocate a Search Results web part on a custom publishing page layout.

<WebPartPages:WebPartZone runat="server" Title="Overview Page Web Part Zone" ID="WpZoneOverviewTeasers" AllowLayoutChange="True"                         AllowCustomization="True" FrameType="TitleBarOnly">
    <ZoneTemplate>
       <SearchWC:ResultScriptWebPart ID="ResultScriptWebPart1" runat="server" AllowEdit="True" />
    </ZoneTemplate>
</WebPartPages:WebPartZone>

Unfortunately that does not quite work. The web part is there but I cannot customize it nor can I delete it. Both of which I want editors to be able to.

I do not want to use a AllUsersWebPart module to provision any web parts. I think that's a good option if you want to make web parts available on a "feature activate" basis.

Another option is to use a custom control to register webparts the first time the page is put into edit mode. See http://code.msdn.microsoft.com/office/Adding-default-web-parts-ab7aec72. Not a big fan either. Mostly because you cannot define properties of the webparts you want to prelocate.

So how do you deploy publishing page layouts with preconfigured web parts on them? Remember authors should be able to configure the web parts to suit their needs and also be able to remove them entirely.

0

A publishing layout is meant to provide a framework for page content. By its very nature, the layout elements are static and only the content controls can be manipulated by the user, i.e. adding text, images, links, etc..

Although web parts can be integrated into a page layout, the web part's settings will be static and not customisable.

You may want to use different page layouts for different settings of a web part.

1
  • In parts I agree. However you can of course put any webparts you like in your web part zones. Therefore it is very well possible to "configure" web parts. The only thing I want to make sure is that web parts are "prelocated" on the page. For example if I choose to create a new page based on "Page Layout News" I want a Search Results web part in my web part zone. The configuration of the webpart can be done by an editor - although it would be nice to supply some default configuration settings which can be modified. – lapsus Sep 23 '14 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.