2
votes

I'm trying to create nested master pages in Umbraco 4.7.1 and I'm having issues.

I've got a masterpage doctype and an index doctype which is a child of masterpage.

Then I have a separate doctype called slide show.

My content looks like this:

  • Index
    • SlideShow

My master page template has the reference to the index like this:

    <asp:ContentPlaceHolder ID="Content" runat="server" />

then inside the index my code is between

    <asp:Content ContentPlaceHolderID="Content" runat="server">
    </asp:Content>

and inside the Index template I reference the next level which is an Image slider

    <asp:ContentPlaceHolder ID="SlideShow" runat="server" />

and the SlideShow template has code between

    <asp:Content ContentPlaceHolderID="SlideShow" runat="server">
    </asp:Content> 

It worked for the Index but not for the slideshow.

The only difference I can think of off hand is the doctype for index is actually a child doctype of the master. And the SlideShow doctype is actually it's own doctype. Not a child of any of them.

Any ideas how to get this working?

1

1 Answers

5
votes

Having nested pages inside Umbraco is perfectly fine. In fact, it's actually an ASP.Net mechanism which doesn't necessarily relate to any heirachy in Umbraco. So it's possible to have unique Umbraco document types which don't inherit from each other, yet one master template is nested in the other.

Master templates work in a way where a master doesn't specify which templates inherit from it, it's always the child template referring to the master template, much like inheritence in object orientated programming languages. The <asp:Content /> tag in the child specifies which <asp:ContentPlaceHolder /> it uses from the parent.

I'm a bit confused how you've setup the master templates from the description, but you should try to have it setup like the following ...

Root Master Template:

<asp:ContentPlaceHolder ID="Content" runat="server" />

Index Master Template:

<asp:Content ContentPlaceHolderID="Content" runat="server">

    <!-- your html -->

    <asp:ContentPlaceHolder ID="IndexLeft" runat="server" />

    <!-- your html -->

    <asp:ContentPlaceHolder ID="IndexRight" runat="server" />

    <!-- your html -->

</asp:Content>

Slide Show Master Template:

<asp:Content ContentPlaceHolderID="IndexLeft" runat="server">

    <!-- your html -->

</asp:Content>
<asp:Content ContentPlaceHolderID="IndexRight" runat="server">

    <!-- your html -->

</asp:Content>

You can create as many nested templates as you want, sanity-permitting. Making a document type use the template Index won't include the slide show. You'd need to give it the Slide Show template instead.

There's more info on it here: http://msdn.microsoft.com/en-us/library/ie/x2b3ktt7.aspx

Hope it helps.