Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Master Page Templates View modes: 
User avatar
Member
Member
robert-tailor.co - 2/11/2013 9:35:51 PM
   
Master Page Templates
Hi,

I'm using Kentico v7.0.19.

I'm going back over some old websites to see if there is a better way to implement my solutions now that I have more experience with Kentico. But some of the Kentico documentation is still very unclear on explaining basic concepts.

Here's a scenario:
- I have a site that supports both Portal and ASPX templates (Not unusual - we are ASP.NET developers after all).
- I have multiple .master page templates (Again, not unusual).

Now I want to make all the .master pages available in the CMS primarily with Portal, but with the flexibility and debugging support offered by Visual Studio.

The documentation at http://devnet.kentico.com/docs/tutorial_aspx/using_the_master_pages.htm seems to suggest that Master page templates can be created and used in the same way as ASPX page templates.

But if I create a Master page with a .master extension, I cannot import it as a Page Template in Site Settings. It seems the .master extension is ignored.

So what *is* the best way to do this? Is this solution (http://devnet.kentico.com/docs/devguide/combining_aspx_templates_and_portal_engine_templates.htm) really the only way to do this?

Isn't there any way for Kentico to parse the contents of a .master page and make it editable, in the same way that ASPX templates can support both Portal and ASPX? Why would there be flexible support for ASPX pages, but not .Master pages?

Thanks!

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/12/2013 7:52:07 AM
   
RE:Master Page Templates
Have you tried adding the pages as a portal master page template then in:
CMS Site Manager>Administration>System>Virtual Objects checking page template layouts? This will allow you to have the file in the file system and allow you to make edits in the CMSDesk.

Also if I remember right, portal master pages aren't actual .master files, they inherit a master page and would most likely be stored as an aspx page.

User avatar
Member
Member
robert-tailor.co - 2/12/2013 3:34:35 PM
   
RE:Master Page Templates
FroggEye wrote: Have you tried adding the pages as a portal master page template then in:
CMS Site Manager>Administration>System>Virtual Objects checking page template layouts? This will allow you to have the file in the file system and allow you to make edits in the CMSDesk.

Yes - it creates ascx files rather than properly formed .master files. You may think I can include this ascx file in an actual .master file, but the .ascx file gets removed from the file system when you sync the objects back to the database.

So, as a developer who wants to use Portal for most pages, but ASPX templates for occasional (special pages), I have to:

1. Create a Master page template in Portal.
2. Create a Master page file on the file system.
3. Write code in the Master page file and abstract out the header and footer into separate ASCX controls (MasterHeader.ascx, and MasterFooter.ascx).
4. Convert the ASCX controls to WebParts.
5. Insert the WebParts on to the relevant zones in the Portal Master page.

Is that correct?

If so, am I the only one who thinks that's a really bad idea? The chances of creating malformed HTML and mismatched elements is almost a certainty, and Visual Studio will generate a lot of design warnings due to tags missing their opening/closing partners.

Surely I must have misunderstood how this works...?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/12/2013 7:46:08 PM
   
RE:Master Page Templates
robert-tailor.co wrote: So, as a developer who wants to use Portal for most pages, but ASPX templates for occasional (special pages)...

Don't mean to question your ability, but tell me why would you need an aspx page when you could simply create an ascx control and use the user control webpart to place it on a portal page?

You can create portal page templates that are master pages (simply check the box). Or even better yet, use visual inheritance vs. all the master pages.

As for your steps, it sounds correct although I've never done it so I can't confirm it. I've worked with Kentico for 4 years and have always used and developed against the Portal development model and have had no issues that I couldn't resolve with a simple ascx control placed on a portal page. :)

User avatar
Member
Member
robert-tailor.co - 2/12/2013 8:23:55 PM
   
RE:Master Page Templates
FroggEye wrote: Don't mean to question your ability, but tell me why would you need an aspx page when you could simply create an ascx control and use the user control webpart to place it on a portal page?

No problem. I've only been using Kentico for a year, and am still learning the best way to do things. I am learning to do things now that I thought couldn't be done a year ago.

Some of the websites we are given to develop will have a similar theme used throughout (colours, fonts, scripts, etc...), but not always consistent design. A single website designed by some media companies may have multiple page designs, where the only reusable content is a company logo and footer. But even then, there will be one or more pages re-using one of the designs.

For pages like these, I have followed the traditional ASP.NET model of creating Master Pages, and MasterMaster Pages. Some pages may refer to a value in the Master page, and some master pages show/hide content based on the content they are displaying.

For complex sites like this (nearly always small, boutique sites designed by 'edgy' media companies), there is more overhead than it's worth trying to make it all work in Kentico, and the programmatic approach offered by ASPX gives me (the developer) the most flexibility, and the fastest turnaround. Especially when it comes to debugging the sites.

But I still want to offer a degree of editable content to the site owners, and so I do try to implement Portal features wherever possible. As I get more familiar with Kentico, I am implementing Portal more and more, but there are still areas where pure ASPX coding is faster and more flexible.

For sites that mix both Portal and ASPX design modes, I'd like to ensure I am not repeating code unnecessarily. Maintaining 2 separate Master pages (1 for Portal, 1 for ASPX) with identical content is tricky enough. But when you start throwing in other Master pages into the mix, it quickly becomes unmanageable.

Both design modes *are* supported after all, but they don't appear to work well together.

User avatar
Kentico Support
Kentico Support
kentico_janh - 2/25/2013 3:56:16 AM
   
RE:Master Page Templates
Hello,

Yes, the .master template can't be registered as a page template in Kentico CMS, however it is always referenced in aspx templates which you can register and in combination of appropriate controls (editable text/image) you can make editable parts of the master page as well. You can check how the mixed mode (PE+ASPX) is made in our sample Corporate Site -> /Examples/Development-models/Mixed-(PE-ASPX).aspx -> (\CMSTemplates\CorporateSite\HomeMixed.aspx)

Best regards,
Jan Hermann