Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Strange Mixed-Mode Template/Document Type Behavior View modes: 
User avatar
Member
Member
david.thornton-pop - 5/3/2012 10:03:42 AM
   
Strange Mixed-Mode Template/Document Type Behavior
I've run into a strange issue when adding new Pages to the tree using a custom Mixed-Mode Page template with a backing Document Type.

Here's what I've done:

- I've created a new Page Template and set the Template type to: ASPX + Portal page and pointed the File Name to the path of my ASPX template in the file system. In the code-behind (aspx.cs), I'm inheriting TemplatePage.
- Created a new Document Type (LandingPage) that inherits from CMS.Page, and added a new attribute to the "Fields" collection.
- Set the Default Page Template to the Page template created above and checked the box "Behaves as Page".

Everything at this point works great. I've added a new Page to the tree and was able to add my web parts to my specified zones. The problem occurs when I add a new Page to the tree using the same Document Type as the previous page and it carries over all of the web parts that I placed into the first page.

If I remove all of the web parts from the 2nd page and go back and view the first page, all of the web parts are now gone from the 1st page. What's going on here? This isn't how Mixed Mode Aspx/Portal pages are supposed to work are they?

Any help would be appreciated as I may have to scrap my whole project approach if this is expected. Thanks in advance!

User avatar
Member
Member
kentico_edwardh - 5/7/2012 2:30:08 PM
   
RE:Strange Mixed-Mode Template/Document Type Behavior
Hello,

One of the downfalls to ASPX page templates is that the code of a page must be modified manually every time you wish to change its design. Version 6.0 added the option of Adding portal engine functionality to ASPX templates by defining areas that can be edited directly through the browser in the CMS administration interface, just like when using the Portal engine development model.

When using the CMSPagePlaceholder control, this will create an area on the page that behaves similarly to a portal engine page template, which included web parts on the page. Each CMSWebPartZone control represent a fully functional portal engine zone. These zones are managed when editing a page based on the page template on the Edit -> Design tab of CMS Desk. When a web part/widget content is added to a zone, information about it is stored in the database along with the respective page template object, not in the actual code of the ASPX page. This approach combines the standard architecture and development process of ASPX templates with the flexibility and user‑friendliness of the portal engine.

Web parts are not saved to the document itself, instead they are saved directly to the page template. If you have webpart_1, webpart_2, and webpart_3 saved to template_1, these webparts will show on any document that is using template_1. Likewise, if you edit these webparts on any document that is using template_1, this change will be reflected across all documents that use template_1.

Best Regards,
Edward Hillard