tags:

views:

256

answers:

3

Hi.

I'm creating some pages using a SiteDefinition, the markup looks something like this:

<File Url="Page.aspx" Name="$Resources:SiteDefinitions,PageName;" Type="GhostableInLibrary">
          <Property Name="Title" Value="$Resources:SiteDefinitions,PageTitle;" />
          <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/Somepage.aspx"></Property>
<AllUsersWebPart WebPartZoneID="WebPartZone1" WebPartOrder="1">
    -- webpart data here
</AllUsersWebPart>
</File>

The page is created as expected, but it's somewhat faulty. If for instance I click Edit Page and then click Publish (without actually editing anything) I will get this error:

"This Page has been modified since you opened it. You must open the page again."

I will get this error approx. every second time I try an editing action.

If I manually create a page using the same page layout everything works as expected and this error does not show up.

Does anybody have an idea what could be wrong?

A: 

I too create a Page using the above method only thing I found missing in your code is that I used to have a title in the PageLayout as

<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/Somepage.aspx, Your title"></Property>

This should not be the cause, but you can try it, Also refer the articles this or this

Kusek
I include titles also in the PublishingPageLayout property. WOuld be kinda weird if that turns out to be the problem, but hey, it IS Sharepoint :-D.
Colin
Any luck from the articles ?
Kusek
None of articles seems to do anything to me. Found out something weird though. If I use SPD to first detach the pagelayout, and then reattach it, the error is gone for that specific page. However It doesn't help me all that much, as my SiteDefinition specifies A LOT of pages.
Peter Lindholm
Now I found this articles that suggest my page layouts should inherit from TemplateRedirectionPage instead of PublishingLayoutPage.When I do that I get a 404 on the page right after creating it. Browsing to te pages library using SPD confirms the file is actually there..hmmI then tried adding the two reference:@ Reference VirtualPath="~TemplatePageUrl" @ Reference VirtualPath="~masterurl/custom.master" as proposed in the comments of the above article - but no luck. When I try to create a page now I'm told: Circular file references are not allowed :( Any clues?
Peter Lindholm
A: 

I think you're right with using PublishingLayoutPage. I came across this article today while searching for this error caused by something else. It describes your same issue although the person in the article was not inheriting from PublishingLayoutPage and had not specified the PublishingPageLayout property. When they fixed this it worked.

This doesn't directly help you, although I did notice in their article that they are specifying the ContentType property. Have you tried specifying this? As you can see your complete code, are there any other differences you see from the article or additional information from the comments?

Alex Angas
A: 

Okay, I (kinda) got this working now.

The guy who had made the ONET.xml had put a reference to the page layout in the Url attribute of the element.

Like I wrote in a comment earlier I tried making the page layouts inherit from TemplateRedirectionPage. Instead I now made an empty default.aspx file that inherits from TemplateRedirectionPage and changed all my page layout files back to deriving from the PublishingLayoutPage. And then I added the PublishingPageLayout element below every element.

Funny, or oddly, having a refence to the page layout in the Url attribute and not having the PublishingPageLayout element at all is actually valid. It doesn't make sense, because it will produce these faulty pages, but SharePoint actually accepts it and spits out all the pages defined in the ONET.xml

Only thing left now is that since I made the above changes, when I manually create a new page based on a page layout every default webpart (as defined with AllUsersWebPart) is instantiated 5 times. Really don't know where this behaviour is coming from, but at least it's not as serious as not being able to edit/publish my pages :)

Peter Lindholm