Kentico CMS 6.0 Developer's Guide

Combining ASPX templates and portal engine templates

Combining ASPX templates and portal engine templates

Previous topic Next topic Mail us feedback on this topic!  

Combining ASPX templates and portal engine templates

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

In some cases, you may need to combine ASPX page templates or external ASPX pages and portal engine page templates on a single website. The following text describes how you can accomplish this.

 

Imagine that you have created a website using the portal engine model. This means that the master page and the other pages use portal engine page templates. The problem here is "inserting" ASPX pages under the same master page. Unfortunately, it's not possible to do this directly. However, you can use the following workaround:

 

Use two master pages: the portal engine master page defined in the root document of the content tree and an ASPX master page (.master file) used for all ASPX pages within the website.

 

The drawback is that you will need to manage the master page in two places. But this issue also has a simple solution:

 

Take the web parts and HTML code you have "above" the Page placeholder web part in your original master page and place them into a user control called Header.ascx. Then, take the web parts and HTML code "below" the Page placeholder and place them into a user control called Footer.ascx as shown in the following figure:

 

devguide_clip0273

 

Now delete the content of the original portal engine master page and place only the following web parts onto the master page template:

 

General/User control web part using the Header.ascx user control

General/Layout/Page placeholder web part

General/User control web part using the Footer.ascx user control

 

In the ASPX master page (.master file), you simply put:

 

the Header.ascx user control

the ContentPlaceHolder control

the Footer.ascx user control

 

In this way, you ensure that you can manage the header and footer in a single place for both the portal engine and ASPX master page.