Page Layouts, Zone Templates, and Content Editor Web parts

Posted: December 9, 2009 in MOSS 2007

Page Layouts, Zone Templates, and Content Editor Web parts

So I have a simple task.
 
 Create a page layout, deployable via wsp that has multiple web part zones with content editor web parts inserted into them with default content and styling applied. I also needed to do it with “no code”.

I get about the task and first run works great:

Sample:

<ZoneTemplate>

<WebPartPages:ContentEditorWebPart runat="server" ID="StorySubheadlineContent">

<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot; xmlns="http://schemas.microsoft.com/WebPart/v2"&gt;

  <Title>QNews subheadline</Title>

  <FrameType>None</FrameType>

  <Description>QNews article sub headline .</Description>

  <IsIncluded>true</IsIncluded>

  <ZoneID>StorySubHeadlineZone</ZoneID>

  <PartOrder>0</PartOrder>

  <FrameState>Normal</FrameState>

  <Height />

  <Width />

  <AllowRemove>true</AllowRemove>

  <AllowZoneChange>true</AllowZoneChange>

  <AllowMinimize>true</AllowMinimize>

  <AllowConnect>true</AllowConnect>

  <AllowEdit>true</AllowEdit>

  <AllowHide>true</AllowHide>

  <IsVisible>true</IsVisible>

  <DetailLink />

  <HelpLink />

  <HelpMode>Modeless</HelpMode>

  <Dir>Default</Dir>

  <PartImageSmall />

  <MissingAssembly>Cannot import this Web Part.</MissingAssembly>

  <PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge>

  <IsIncludedFilter />

  <ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor&quot; />

  <Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">&lt;![CDATA[<FONT size=3><STRONG>This is formatted text</STRONG></FONT>]]></Content>

  <PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor&quot; />

</WebPart>

</WebPartPages:ContentEditorWebPart>

</ZoneTemplate>

 

Next time around, I manually upload the aspx into the pagelayouts/masterpage lib over top of the old one, publish it, approve it and all hell breaks loose. Sometimes I get the same web part twice,m some uploads, I get “No parameterless constructor defined for this object.” message trying to create the page with the template. I can remove everything from the entire layout except the word “hi” and this message keeps coming.  

 

It is clearing the parameterless constructor message I find my savior at:  http://vspug.com/teameli/2009/08/13/dealing-with-the-quot-no-parameterless-constructor-defined-for-this-object-quot-on-changed-page-layout/

 

What I find is MOSS would add the new web parts I put in and cache the old ones. Even though they no longer existed in the aspx file, they did to MOSS and they would until manually cleared through the web part maintenance page. So if you find yourself in this pickle, try the following procedure as you are updating the aspx file.

 

1.       Save new aspx to the development HD.

2.       Go to http://<server url>/_catalogs/masterpage/<pagelayoutname>.aspx?contents=1

3.       Check out, Delete all web parts

4.       Upload new version

5.       Publish and approve

I hope this can save some of you a good deal of time.

Advertisements
Comments
  1. Rubens says:

    Somebody buy this man a beer!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s