+1-888-365-2779
Try Now
More in this section

Forums / Designing with Sitefinity / Nested Master Pages Madness

Nested Master Pages Madness

11 posts, 0 answered
  1. John
    John avatar
    5 posts
    Registered:
    18 Feb 2009
    14 Apr 2009
    Link to this post

    Hello,

    I'm a first time Sitefinity user trying to build a pilot project in the Community Edition.  I'm already stumped at what should be one of the most basic setups of a site. I have a site that globally shares a common header, menu, footer, and nothing else. Other pages use one of a number of different layouts.

    So I'm thinking the way to tackle this is to use nested master pages with the parent masterpage defining the header, footer, and contentplaceholders for the menu and body. Each child masterpage will inherit the above and further create contentplaceholders as necessary in the "body" of the parent.

    I set it all up as described and upload it to the site. At first glance, everything looks good. I then add a "Navigation Site Menu" to the parent masterpage, which shows up fine on the parent, but not on the child masterpages!! So I check the Telerik site and find a KB article that confirms that in practice, templates don't really support nesting.

    So basically, nesting is supported only insofar as ASP.NET supports it. CMS content cannot be nested. Is that correct? I'm hoping I've missed something along the way, because it seems like a very severe limitation.






  2. Dido
    Dido avatar
    149 posts
    Registered:
    24 Sep 2012
    17 Apr 2009
    Link to this post
    Hi John,

    I am sorry if this has caused you inconvenience or confusion. Sitefinity is built on top of ASP.NET. It is true that we extend ASP.NET to enhance some things (e.g. the template parser), but we don't extend everything.

    If you have a behavior that is repeatable, it is advisable to create different templates (the Sitefinity encapsulation of a .master + theme + UI-added controls). Since you create pages from templates and not .master pages directly, you could do that. Look at the community site template for an example of how to do this.

    Write us if you need more assistance or if something is not clear to you. We appreciate constructive criticism, as it makes Sitefinity better.

    Sincerely yours,
    Dido
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. John
    John avatar
    5 posts
    Registered:
    18 Feb 2009
    17 Apr 2009
    Link to this post
    Hi Dido,

    I have looked at the Community Site Template, but maybe I'm just not getting it.

    The way I currently understand it, if I have a site with two basic layouts - say a 2-column page and a 3-column page- that share a common header and footer, I would need to create two different templates. Each template in turn requires its own master page.

    That part is understandable; but what is frustrating me is that the two master pages themselves cannot inherit from a common "base" master page that defines the header and footer, even though this is supported in ASP.NET, and is indeed probably the biggest advantage of a master page.

    Now, because multiple controls can only be laid out vertically within a ContentPlaceHolder, any time that I need a new horizontal control placement I have to create a new template. As it turns out, this (horizontal control placement) seems to happen a lot, so I find that I need to create many different templates, which in turn require an equal amount of master pages. And since Sitefinity does not properly support nested master pages, the header and footer code must be duplicated across all of those master pages. It's a maintenance hassle, and a nightmare during development when changes are frequent and need to be repeated across each master page.

    I'm still of the opinion that I must not be understanding how to properly structure my site. This method is so laborious that I have to assume you've provided a better way, and I've just not found it yet.







     
  4. Dido
    Dido avatar
    149 posts
    Registered:
    24 Sep 2012
    21 Apr 2009
    Link to this post
    Hi John,

    First, I'd ask you to watch this video about templates and themes in Sitefinity. It explains the basics.

    Second, templates can share .master pages. Moreover, you could come up with a very generic .master with as much content place holders as you would need. Then you could duplicate the template and things as you need. You can "disable" a content place holder if you put an empty generic content control in it in the template editor.

    You can have many controls on a placeholder. ContentPlaceHolder is just a regular control, so you could instantiate a template in it, if you want to use this approach. Programatically, you could achieve almost anything.

    Something else that you might have missed: a template has a default theme, but it can have as many themes as you need. For example, see Default.master, the Default template and its four theme variations. It is the same .master with the same template, and the themes (css) define the look.

    If you have some nice suggestions, now is the time: we are planning for 4.0, so if we like the idea, and have time to implement it, it will be included!

    Kind regards,
    Dido
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    23 Nov 2009
    Link to this post
    Say I am using one master page called "Master Template". I create a template by duplicating this master page and call it "Landing Page". Then I duplicate the "Landing Page" and call it "Sub Page".

    So the "Landing Page" and the "Sub Page" templates are all from the same master page.

    If I put a control on the "Landing Page" template that is say an image select control, it does not trickle down to the pages that are created by the "Sub Page" template. 

    Should it? The only way I can get the "Sub Page" template to update is to delete it and duplicate the "Landing Page" again, recreating the "Sub Page" template.

    It would be nice if the controls "trickled down" to their duplicate pages, but not necessarily trickled up.

    Does this make any sense?
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    24 Nov 2009
    Link to this post
    Hi Laura,

    The behavior that you are explainig is default behavior. When you duplicate a Template/Page the CMS creates another instance of a Template/Page that has the same controls as the original one but it is completely independent. It is the same when you copy/paste files in Widows. When you change the original file the pasted file (duplicated one) does not get changed.

    Kind regards,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Martin Meixger
    Martin Meixger avatar
    7 posts
    Registered:
    27 Sep 2009
    05 Dec 2009
    Link to this post
    "... that the two master pages themselves cannot inherit from a common "base" master page that defines the header and footer ..."

    I archive exactly this by nesting my master pages with the MasterPageFile attribute.

    regards,
    Martin
  8. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    07 Dec 2009
    Link to this post
    Hi Martin,
    Thatk you for your response. I am curious to know more...  In Sitefinity, I do now have just one Master Page. I them can create templates from this master page. (Need one for each navigation section because each section has it's own image attributes). I know whatever code (or link to say a javascript file) I put behind the Master Page in VS is used by all the templates created from it in SF. I then control the appearance (two-colum, three-column, etc. all thru CSS.  It's actually pretty cool the way I created many different layouts by simply using different Themes. I do now understand the purpose behind why the items you place on a template don't 'trickle down'!   It does make sense to me know!

    Anyway, is the above similar to what you mean? Also, are you able to drag controls into the head section of a template? Such as a link to a javascript file? I am getting errors doing that...

    Thanks!
    Laura
  9. Zahid Ali
    Zahid Ali avatar
    47 posts
    Registered:
    16 Nov 2009
    08 Dec 2009
    Link to this post
    hi Laura,

    Say if my homepage has a different structure to that of a drill down page, how did you acheive this using different themes?

    themes from my understanding is just the skin for the layout - and not a set of different div structure.

    Let me know if I've missed out something.

    thanks.

    Zahid
  10. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    08 Dec 2009
    Link to this post
    Hi Zahid,

    Let's say I have a three column layout.  I use a main style sheet called say "main.css" and size the three colums maybe as such:
    #contentwrapper{  
    float: left;  
    width: 100%;  
    background-image:url("images/bkgd_3col.gif");  
    background-repeat:repeat-y; height:100%;  
    margin-top:8px;  
    margin-bottom:8px;  
    min-height:707px;  
    }  
     
    #contentcolumn{  
    margin: 0 184px 0 184px; /*Margins for content column. Should be "0 RightColumnWidth 0 LeftColumnWidth*/  
     
    }  
     
     
     
    #leftcolumn{  
    float: left;  
    width: 184px; /*Width of left column in pixel*/  
    margin-left: -802px; /*Set margin to that of -(MainContainerWidth)*/  
    margin-top:8px;  
    }  
     
    #rightcolumn{  
    float: left;  
    width: 184px; /*Width of right column*/  
    margin-left: -184px; /*Set left margin to -(RightColumnWidth)*/  
    background: #FFFFFF;  
    margin-top:8px;  

    then I have a theme called say "Two Coumns"
    I have a style sheet in that theme with the following code to 'convert' the three columns to two columns.
    Note I import the main css file first then overwrite certain items using !important and dispaly:none.
    I hide the right column using display:none, then change the margins of the other columns (make the margin for right=0 and left=184px; the width of the left column") and also changing the background image. This can be used for anything on the page.
    @import url("main.css");  
     
    #rightcolumn {display:none !important;}  
     
    #contentwrapper{  
    background-image:url("images/bkgd_2col.gif") !important;  
    }  
     
    #contentcolumn{  
    margin: 0 0 0 184px !important;   /*Margins for content column. Should be "0 RightColumnWidth 0 LeftColumnWidth*/

    For instance, i also have a 'theme' that includes a table on the page. On the main css file I hide it by using display:none but in the custom theme I show the table, all using the same master page, and just adding css attributes.

    Hope this helps.
  11. Zahid Ali
    Zahid Ali avatar
    47 posts
    Registered:
    16 Nov 2009
    08 Dec 2009
    Link to this post
    Hi Laura,

    I think I know where you are coming from. However, I feel this could make the master file very cluttered.

    Anyway, thanks for the help.

    Zahid
Register for webinar
11 posts, 0 answered