Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Page templates and page layouts View modes: 
User avatar
Member
Member
robert-tailor.co - 2/12/2013 7:41:39 PM
   
Page templates and page layouts
Hi,

I'm having trouble understanding the differences between a page layout and a page template.

I understand that a page layout can be used to define the layout of any ad-hoc page.
I also understand that a page template can be used to define a fixed layout.

But is it possible to create a page template that contains an area in which I can place a page layout?

So, for example, let's say I have a standard 3-row page design: header, content and footer.

The header contains a heading, and optional sub-heading.
The content can be 1, 2 or 3 columns of content.
The footer is static.

I want the user to be able to have an editable region to enter an optional sub-heading on each page. And I want the user to be able to choose (and change) between a 1, 2 or 3 column layout for the content.

If I make the sub-heading an editable region in the master page, this makes it unavailable on the page that is inheriting it. If I place the editable region in a page template, I am locked into the page template's fixed layout.

What is the best way to achieve this level of flexibility? Should I make the Sub Heading a document form field and output that? I'd like to keep all editable text on one page if possible...

Thanks!

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/12/2013 8:31:26 PM
   
RE:Page templates and page layouts
There is a good visual on the Devnet but I can't seem to find it now. Here's my version:

Page templates hold the page layout which hold the webpart/widget zones which hold the webparts/widgets which display the content.

A quick example I have is a website that has chapters. Your main Chapters page consists of a Chapters Template. The page displays a list of all the chapters nested under it. Then you create a new page template (Site Manager>Development>Page Templates) called Chapters Sub with a different layout (or the same, up to you). On the Design tab of the page template you will see a blank page. Click the Layouts tab and select a shared layout (2 columns). Switch back to the Design tab and add a Static Text webpart to the template. In the settings set the text to a macro that will get the current document name {% CurrentDocument.DocumentName %} and click Ok.

Now go back to CMSDesk and right click the Chapters page and add a a few new pages with different names, select your page template you created (if you don't see it, you will have to assign your site to it in Site Manager). Navigate back and forth to the pages and see the dynamic page name change. This is the nice benefit of a template and layout. The catch is if you modify a webpart on one page it will modify it across all pages that use the template.

What you're explaining is a master page setup. If you haven't done much in Kentico, I suggest installing the Corporate Site and looking at how it is setup. This will probably answer a lot of your questions.

User avatar
Member
Member
robert-tailor.co - 2/12/2013 10:23:08 PM
   
RE:Page templates and page layouts
Thanks for the detailed explanation.

I think I'm getting a bit closer to understanding this now.

One thing the Corporate and ECommerce sites seem to carefully avoid demonstrating is the one thing I need for my site:

To reiterate, I have a common layout across all pages:
- A header containing a title and user defined sub-heading.
- A choice of 1, 2, or 3 columns.
- A static footer.

If I take your suggestion of using a shared page layout, I should put the user definable sub-heading in a zone defined in the Page Layout, and add a Web Part in the Page Template. But this means manually adding the same editable area Web Part to all Page Templates, and this seems like an unnecessary duplication of code.

If I put this user editable area in the Master layout, then it is not editable on any child pages (unless there's a way to make certain Master Page Web Parts editable in child documents).

Another option would be to add a text area to the Form Controls and make it editable there, but then *all* documents need to contain a 'SubHeading' field or the page will give a runtime error.

I'm sure I can't be the only one to ask this question. Is there a more elegant way to solve this issue?

User avatar
Member
Member
robert-tailor.co - 2/13/2013 8:21:15 PM
   
RE:Page templates and page layouts
The more I use page templates, page layouts and master pages, the more I'm convinced this was whole thing was designed by someone who has never actually used it.

This is so frustrating. How can something so fundamental to the foundation of Kentico based websites be so badly explained in all the documentation and tutorials?

It would be *really* helpful if somewhere in the Kentico documentation it showed:

1. What a Page Layout is, where and when you should use it, and why you would use it over a Page Template. It would also help if you could show what scope it has, and where it can be edited, and why you would edit it on the CMSDesk as opposed to the Development section of Site Settings.
2. What a Page Template is, where and when you should use it, and why you would use it over a Page Layout. It would also help if you could show what scope it has, and where it can be edited, and why you would edit it on the CMSDesk as opposed to the Development section of Site Settings.
3. What a Master Page is (it's different in principle and scope to what an experienced ASP.NET developer *thinks* it is), and how changes to that affects all the pages below it.

All the documentation tells us to do is to push a few buttons and marvel at how it changes the carefully designed pre-defined layouts chosen by Kentico's staff. Nowhere in their documentation do they make it clear *why* they chose the specified design, and what effect changing certain values will have, and how it fits into the bigger overall design of Kentico.

:-(

User avatar
Kentico Support
Kentico Support
kentico_radekm - 2/20/2013 1:37:11 AM
   
RE:Page templates and page layouts
Hello.

We were dealing with these questions in the support ticket. If you find any of my advices useful, you can post them here for reference. Thank you.

Best Regards,
Radek Macalik

User avatar
Member
Member
rlull - 7/17/2013 11:42:43 AM
   
RE:Page templates and page layouts
Any chance you could post the answers to these questions?

User avatar
Member
Member
alex.crossley-carnivalaustralia - 4/9/2014 7:19:58 PM
   
RE: Page templates and page layouts
Agreed, the template / layout / master page architecture is by no means intuitive to anyone who has designed or built websites in anything other than Kentico.

Other than that, the page builder is excellent, but you get no points for making it easy to design a common overarching "layout" for a site without having to specify the individual components at design time.