---
title:        "Tweaks: Adding custom page layout codes"
description:  "In this tweak I will demonstrate how easy it is to add custom codes that will show up in the layout element selector within the layout properties of page template."
url:          https://www.jeroenfurst.nl/blog/Tweaks-Adding-custom-page-layout-codes
date:         2012-10-18
category:     Web parts and page templates
tags:         [Web parts and page templates]
reading_time: 1
---

# Tweaks: Adding custom page layout codes

> In this tweak I will demonstrate how easy it is to add custom codes that will show up in the layout element selector within the layout properties of page template.

In this tweak I will add a custom element that will allow me to easily add a code snippet needed for multiple placeholders. For more information regarding multiple placeholders please read this [blog post](~/blog/september-2011/tips-and-tricks--3--page-template-reduction---mult).
 
 First locate the file **CMSFormControls\\Layouts\\PageLayoutCode.ascx.cs** and add the following code in the specified lines:
 
 **Line 150:**

```
drpElements.Items.Add(new ListItem(GetString("PageLayout.MultiplePlaceHolder"), "mpl"));
```

**Line 177-179:**

```
case 'mpl':
            elem = '<cms:CMSContent runat=""server"" id=""cntContent"" PagePlaceholderID=""plcContent""><cc1:CMSWebPartZone ID=""zoneA"" runat=""server"" /></cms:CMSContent>';
            break;  
```

This should look similar to the following screen:
 
 [![Page layout code](~/getattachment/Blog/October-2012/Tweaks-Adding-custom-page-layout-codes/PageLayoutCode.png.aspx?width=660&height=347)](~/getContentAsset/bdd52a80-eee3-4be9-8244-26a26be7ad59/310c1ea5-13ca-4d75-95a0-620f51989b44/4145ca14_PageLayoutCode.png.png)
 
 Next make sure to add the localization string in the UI Cultures module:
 
 **Key:** *PageLayout.MultiplePlaceHolder*
 **Text:** *Multiple placeholders*
 
 View the result:
 
 [![Page template layout properties](~/getContentAsset/07e88e1d-ea76-4ff9-938d-b0dddf8354a1/310c1ea5-13ca-4d75-95a0-620f51989b44/086c1479_page_template_properties.png.png?width=660&height=347)](~/getContentAsset/07e88e1d-ea76-4ff9-938d-b0dddf8354a1/310c1ea5-13ca-4d75-95a0-620f51989b44/086c1479_page_template_properties.png.png)
 
 Enjoy :)