7 YEARS AGO

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.

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

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

Enjoy :)