Best Practices
General > Best Practices > Layouts vs. Pages vs. "sub pages" View modes: 
User avatar
Member
Member
matt - 11/28/2006 8:44:30 PM
   
Layouts vs. Pages vs. "sub pages"
When you have a CSS layout for a template and you base your top level pages on that template. What's the best practice when you create the level of pages below that? Should those pages just inherit the layout of the parent page? Should they use they're own template? own layout?

I'm having a problem where my sub pages are inheriting the web parts of their parent pages. Including the content areas. So I wind up with all the content from the next higher level page in the heirarchy on each sub page.

How do I avoid this? Am I doing something wrong in my layout? Something wrong in my template? Or something wrong when I create a new page item?

Here is my base layout:
<div id="top-bar"></div>
<div id="site-wrapper" class="interior">
<a href="template_home.html" id="interior-link">Pinnacle</a>
<div id="header">
<cc1:CMSWebPartZone ID="MainNav" runat="server" />
</div>
<div id="nav-col">
<cc1:CMSWebPartZone ID="SubNav" runat="server" />
</div>
<div id="content-col">
<cc1:CMSWebPartZone ID="MainContent" runat="server" />
</div>
<div id="news-col">
<cc1:CMSWebPartZone ID="RightContent" runat="server" />
</div>
<div id="footer">
<cc1:CMSWebPartZone ID="Footer" runat="server" />
</div>
</div>

When I create a page at the top level of navigation and add web parts to each zone as appropriate (like a navigation part to the MainNav zone, etc.), those pages render just fine. When I create a new page under that new page, all the web parts from the first page are inherited?

What am I doing wrong?


User avatar
Guest
admin - 11/28/2006 8:51:50 PM
   
Re: Layouts vs. Pages vs. "sub pages"
Yes, all content from the parent page is inherited by default.

You can break the inheritance using the Inherit page levels property of the page template (e.g. /1 means that the top-level pages do not inherit master page content)

or

you can check the Hide on sub-pages box in web part properties.

You can find more details on visual inheritance and its breaking in Kentico CMS Tutorial -> Chapter 4.5.

Best Regards,

User avatar
Member
Member
matt - 11/28/2006 8:54:57 PM
   
Re: Layouts vs. Pages vs. "sub pages"
WOW...I feel dumb. Second checkbox on the configure options of each web part "Hide on sub-pages:".

Voila, problem solved.

Yet, I have another issue now. I don't have any zones to add web parts to on the sub pages. I think I need to go back and read over the page layouts, templates and nested pages sections of the documentation again.

User avatar
Guest
admin - 11/28/2006 9:10:33 PM
   
Re: Layouts vs. Pages vs. "sub pages"
You may want to check if you have any page placeholder web part on the parent page template - this web part ensures loading of sub-pages.

User avatar
Member
Member
matt - 11/28/2006 9:36:57 PM
   
Re: Layouts vs. Pages vs. "sub pages"
You're saying that I have to add a placeholder web part inside a zone of the parent page to have a zone to which I can add web parts on any sub pages?

When I do that I get the page wrapped around the page. Why can't I just make a page and have it apply a template (based on a layout) without inheriting anything from it's parent page?

I'm very confused about how I'm supposed to set up layouts to utilize templates.

User avatar
Member
Member
matt - 11/28/2006 10:05:37 PM
   
Re: Layouts vs. Pages vs. "sub pages"
I'm going to send you some more detailed information and screenshots. Maybe you can help me figure out where I'm going wrong?

User avatar
Member
Member
matt - 11/29/2006 10:06:44 PM
   
Re: Layouts vs. Pages vs. "sub pages"
I finally figured out how to do what I was originally trying to accomplish by altering the template inheritance properties.

I was having trouble with pages inheriting the template from their parents. It makes sense to do that in most cases but in this particular instance it wasn't going to work.

I found the explanation in the Developer's Guide>Programming and API>Content Inheritence...just in case anyone else come across this same type of misunderstanding :)