7

I am creating a custom page layout using SharePoint Designer. I want to add the search box to this page layout in one of my div.

How can I achieve this?

  • I think you're missing the end of second sentence. – Slaven Semper Jan 2 '15 at 11:44
  • 2
    Please tag your SharePoint version. For 2010 & 2013 we can add webpart zone in different ways. – Amal Hashim Jan 2 '15 at 12:57
15

SharePoint 2013

In 2013 you can use design manager for generating web-part zone snippet.

  1. To insert a Web Part zone snippet
  2. Browse to your publishing site.
  3. In the upper-right corner of the page, choose the Settings gear, and then choose Design Manager.
  4. In Design Manager, in the left navigation pane, choose Edit Page Layouts.
  5. Select the name of the page layout that you want to add the snippet to.
  6. To open the Snippet Gallery, choose Snippets in the upper-right corner of the server-side preview.
  7. On the ribbon, on the Design tab, choose Web Part zone.
  8. On the right side of the Snippet Gallery, under About this Component, click or select section headers to expand or collapse groups of properties, and then configure any custom settings that you want.
  9. After you configure any properties, choose Update. This updates the HTML snippet on the left side of the page, so that the markup reflects your custom settings. You can always choose Reset to return all properties to their default settings.
  10. On the left side of the Snippet Gallery, under HTML Snippet, choose Copy to Clipboard.
  11. In your HTML editor, open the mapped network drive on your computer, and then open the HTML file for the master page or page layout that you're adding the snippet to.
  12. In the HTML file, paste the snippet where you want the markup to appear.
  13. Replace the <div> where class="DefaultContentBlock" with your own specific content.
  14. If you want to prepopulate the zone with Web Parts—for example, if the zone will restrict content authors to modifying only existing Web Parts and not adding new ones—insert Web Part snippets where the <!--DC … --> tag appears.
  15. Save the page, and then refresh the server-side preview in Design Manager to make sure the page appears as expected.

http://msdn.microsoft.com/en-us/library/office/jj862341(v=office.15).aspx

Design Manager generates snippet in following format

<div data-name="WebPartZone">
    <!--CS: Start Web Part Zone Snippet-->
    <!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
    <div xmlns:ie="ie">
        <!--MS:<WebPartPages:WebPartZone runat="server" ID="x0e5f5212505f48a9aac43df13eeae4f9" AllowCustomization="True" AllowPersonalization="False" FrameType="TitleBarOnly" LockLayout="True" Orientation="Vertical">-->
            <!--MS:<ZoneTemplate>-->
               <!--DC: Replace this comment with default web parts for new pages. -->
            <!--ME:</ZoneTemplate>-->
        <!--ME:</WebPartPages:WebPartZone>-->
    </div>
    <!--CE: End Web Part Zone Snippet-->
</div>

You can copy this into Page Layout (html) file.

SharePoint 2010

  1. Open the page layout in SharePoint Designer
  2. Place cursor inside the div where you want to place the webpart zone
  3. From Menu, Select Insert -> Web Part Zone
  4. Save and Publish the Page Layout
  • 1
    this is a second way to do it. – Mancy Desaee Feb 13 '15 at 11:12
8

Add the following snippet:

<WebPartPages:WebPartZone runat="server" Title="TestZone1" ID="TestZone1">
<ZoneTemplate></ZoneTemplate>
</WebPartPages:WebPartZone>

It works.

  • How can i create the web part zone with PublishingPageContent. And I want to add the Zone Title & Zone Index to this Web Part zone! – Mohamed Arif Sep 23 '16 at 13:15

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.