12
Vote

Supporting Container Pages in CMS 6 R2

description

Container pages are page types with no template file. However, if the filename attribute is missing when decorating a page type class with PageTypeAttribute, the PageTypeUpdater class will set the property to "~/default.aspx".

comments

tompipe wrote Aug 2, 2011 at 3:11 PM

Change the value of DefaultPageTypeFileName at the top of PageTypeBuilder.Syncronization.PageTypeUpdater from "~/default.aspx" to "" (empty string)

joelabrahamsson wrote Aug 2, 2011 at 5:55 PM

That would break the support for R1 :(

tompipe wrote Aug 2, 2011 at 6:44 PM

I've added the PTB source to our R2 solution and changed it there. It was meant as a workaround not as a fix :)

Another workaround would be to attach to the EditPanel_LoadedPage event and force e.Page.HasTemplate to false.

wrote Aug 26, 2011 at 11:37 AM

wrote Sep 12, 2011 at 7:03 PM

jamespatterson wrote Sep 23, 2011 at 2:08 PM

Just came across this today. I would think just changing the condition for setting the Filename in methods CreateNewPageType and GetFilename (of PageTypeUpdater) would help.

If the filename attribute is NULL then assign the default, otherwise use the value the developer has set even if it's empty.

wrote Sep 23, 2011 at 2:13 PM

wrote Sep 23, 2011 at 2:14 PM

alfnilsson wrote May 3, 2012 at 1:34 PM

You can create a constructor on your pagetype and set HasTemplate = false but remember that your default.aspx (if you're not setting a certain .aspx yourself) must inherit SimplePage or a class inheriting to trigger LoadCurrentPage() which in turn is responsible to throw your 404.

alfnilsson wrote May 3, 2012 at 1:34 PM

You can create a constructor on your pagetype and set HasTemplate = false but remember that your default.aspx (if you're not setting a certain .aspx yourself) must inherit SimplePage or a class inheriting to trigger LoadCurrentPage() which in turn is responsible to throw your 404.

wrote Aug 9, 2012 at 10:43 AM

wrote Aug 9, 2012 at 10:45 AM

wrote Aug 9, 2012 at 10:49 AM

adam_jenkin wrote Aug 9, 2012 at 11:08 AM

+1 to James solution. We use container pages on almost every project, and for the past 5 or more we have taken a copy of the source and made this simple change to use PTB for container pages.

This solution doesn't break support for R1, just enables developers using R2 to set the file name to an empty string to indicate a container page.

https://gist.github.com/3303287

(James code change - credit to him)

wrote Feb 14, 2013 at 7:04 PM