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

Forums / General Discussions / Nesting master pages?

Nesting master pages?

6 posts, 0 answered
  1. Ben
    Ben avatar
    9 posts
    Registered:
    23 Dec 2010
    18 Mar 2011
    Link to this post
    Hi,

    I need to have a footer with a number of content place holders pre-filled with content across a number of pages, how do I go about doing this?

    I have tried nesting master pages but the content does not show if I add it to the master page template.

    I could probably solve the problem by using iframes but really would prefer not to.

    Many thanks

    Ben.
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    24 Mar 2011
    Link to this post
    Hello Ben,

    I need to have a footer with a number of content place holders pre-filled with content across a number of pages, how do I go about doing this?

    If this content is coming from Sitefinity, then you can go to Pages-> Templates, select the needed template and put the needed controls with the content in. Upon saving, these changes will be applied to template, respectively to all pages that use this template. 
    I don't think that you need nested masterpages for this.

    Regards,
    Georgi
    the Telerik team
  3. Ivor
    Ivor avatar
    20 posts
    Registered:
    28 Sep 2010
    24 Mar 2011
    Link to this post
    Hi,

    Thanks for getting back to me.

    Unfortunately my site uses a number of templates and each template needs to have the same footer repeated.

    Any ideas?

    Many thanks

    Ben.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Mar 2011
    Link to this post
    Hello ,

    Please take a look at this KB

    http://www.sitefinity.com/devnet/kb/sitefinity-3-x/does-sitefinity-support-nested-master-pages.aspx

    So here is how you can create nested masterpages in SF.

    1.   You have two masterpages declared below
    2.   In the 1st one you add ContentView control and specify the id of the IContent item you want to display – it will be hardcoded in the master page.

    <%@ Master Language="C#" AutoEventWireup="true" Inherits="App_Master_MasterPage1" %>
    <%@ Register TagPrefix="gc" Namespace="Telerik.Cms.Engine.WebControls" Assembly="Telerik.Cms.Engine" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <asp:ContentPlaceHolder id="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body>
        <form id="form1" runat="server">
        <div id="header">
           HERE IS THE HEADER THAT WILL BE USED IN ALL NESTED PAGES THAT WE HAVE. HERE WE REGISTER OUR CONTENT VIEW CONTROL
       <gc:ContentView ID="cv" runat="server" SelectedItemId="HERE THE ID OF THE ITEM" ></gc:ContentView>
            <asp:Image ID="image1" runat="server" />
        </div>
        <div>
            <asp:Literal ID="lit" runat="server" Text="some text..."></asp:Literal>
            <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
        </div>
        </form>
    </body>
    </html>

    --------------

    nested page

    <%@ Master Language="C#" MasterPageFile="~/App_Master/MasterPage1.master" AutoEventWireup="true" Inherits="App_Master_MasterPage2" %>


    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    </asp:Content>

    Regards,
    Ivan Dimitrov
    the Telerik team
  5. Ivor
    Ivor avatar
    20 posts
    Registered:
    28 Sep 2010
    29 Mar 2011
    Link to this post
    Hi Ivan,

    That is similar to what I tried, but I can't have any hard coded content as the site need to be multilingual, so any text repeated in the header needs to be editable in Sitefinity.

    If Sitefinity can't do this, does Sitefinity 4 have a way around this?

    Many thanks

    Ben.
  6. Anton Mernov
    Anton Mernov avatar
    110 posts
    Registered:
    03 Dec 2008
    30 Mar 2011
    Link to this post
    Hi Ivor,

    Try to use the following approach. It allows us to put and manage localized content in master pages.

    1. Add your content items into GenericContent module. For instance, create Header and Footer items. If you want to have them on different languages, they should be localized and have the same item IDs.
    2. In the parent master page you have to add GenericContent controls and specify their ContentID:

    <%@ Master Language="C#" %>
    <%@ Register Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" TagPrefix="sf" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
        <script runat="server">       
            protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);
     
                header.ContentID = new Guid("88c56352-c456-4112-8103-c2d5bc713e3d");
                footer.ContentID = new Guid("c93f8742-c683-4e49-8226-bd879c9c563e");             
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <div class="header">
                <sf:GenericContent id="header" runat="server"></sf:GenericContent>
            </div>
            <div class="body">
                <!-- body is here -->
                    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">           
                    </asp:ContentPlaceHolder>
            </div>
            <div class="footer">
                <sf:GenericContent id="footer" runat="server"></sf:GenericContent>
            </div>
     
            <asp:ScriptManager runat="server" ID="ScriptManager1">
            </asp:ScriptManager>
        </form>
    </body>
    </html>

    I hope this help.

    Best regards,
    Anton.
Register for webinar
6 posts, 0 answered