i am currently testing and running a umbraco buisiness starterkit. and fiddling with templates.
i am a lil bit confused regarding relationships. i have noticed that i can only choose content areas from a tempate that is directly above the current template for example.
--> --> Menu template( should be possible to inject into content templates. hence the double "arrows")
-->foot template
or is there an easier way for this? as it is now we have lots of templates that seems a bit redundant, as they only handle one actuall page on the site, with the content.( due to item fields)
yes, something like that would definitely work, although not really sure if you need all of this. I know some people always provide ContentPlaceholders for all sections on a site, personally I like to be more minimal in that regard. Imagine with each nested masterpage you go one step from the general to the more specific. If you find out that you don't need to be specific on a deeply nested masterpage then you can transfer that content to the masterpage one above and don't need to provide the nested masterpage with the ability to itself insert content there.
An example: let's say all of your pages use the same footer. Then your topmost masterpage (or template to speak in Umbraco terms) can have a <div id="footer">...</div> section at the bottom which contains the footer, yet it wouldn't contain any ContentPlaceholders as there is no need for a nested template to add anything to the footer.
Now let's assume you have e.g. a shop sub section and you need to insert a special terms and conditions link in the footer (this is just theoretical, probably not the best idea to put the link there). Then you could do something like this on your topmost masterpage:
This gives all nested masterpages the option (you don't need to use all of the ContentPlaceholders that the masterpage offers) to insert their own links to the footer at the specified place which you control on the topmost masterpage.
Another example: you have 2 and 3 column layouts. As it is, the 3 column layout is just a specific case of the 2 column layout (depending on the Html markup that might not be true!). So you can have a 2 column masterpage which has a ContentPlaceholder for LeftColumn and another one for RightColumn, then you could set up a 3 column nested masterpage which splits the LeftColumn into 2 ContentPlaceHolders, LeftFirstColumn and LeftSecondColumn. The advantage here is that you can insert the markup that will force the split in the 3 column masterpage so all masterpages who 'inherit' this one don't have to worry about that.
<asp:Content ContentPlaceHolderId="LeftColumnPlaceHolder" runat="server"> <div id="leftFirstColumn"> <h2>this is the left column</h2> <asp:ContentPlaceHolder ID="LeftFirstColumnPlaceHolder" runat="server"></asp:ContentPlaceHolder> </div> <div id="leftSecondColumn"> <h2>this is the middle column</h2> <asp:ContentPlaceHolder ID="LeftSecondColumnPlaceHolder" runat="server"></asp:ContentPlaceHolder> </div> </asp:Content> <asp:Content ContentPlaceHolderId="RightColumnPlaceHolder" runat="server"> <!-- right column content --> </asp:Content>
Now, in this case it might not be necessary to provide the RightColumnPlaceHolder here, because the implementation might be the same for both of them, e.g. a dynamically created menu based on the location of the current page in the hierarchy. In this case you can just omit that and insert the call to the macro in the 2 column template so you don't have to insert the same code over and over again in each nested template.
and nothing shows, absolutely nothing. white blank page, with no markup in source whatsoever. i have allowed startsida page document type to use both those templates.
this should definitely work. You only need to allow the nested template on the document type. If you still see nothing try to create a new document type with template, add just some text to the template (without doing anything else) and create a content node using that template. If you still can't see anything then something else might be messed up. Let us know!
How does the structure of templates really work
i am currently testing and running a umbraco buisiness starterkit. and fiddling with templates.
i am a lil bit confused regarding relationships. i have noticed that i can only choose content areas from a tempate that is directly above the current template for example.
for example, would this work?
master template
--> head template
-->content template 1 ( frontpage layout )
--> content template( 3 column)
-->--> page 1 (3 column layout) template ( umbraco field items)
-->--> page 2 (3 column layout) template ( umbraco field items)
-->content template ( 2 column)
-->--> page 1( 2 column layout) template ( umbraco field items)
--> --> Menu template( should be possible to inject into content templates. hence the double "arrows")
-->foot template
or is there an easier way for this? as it is now we have lots of templates that seems a bit redundant, as they only handle one actuall page on the site, with the content.( due to item fields)
Hi Martin,
yes, something like that would definitely work, although not really sure if you need all of this. I know some people always provide ContentPlaceholders for all sections on a site, personally I like to be more minimal in that regard. Imagine with each nested masterpage you go one step from the general to the more specific. If you find out that you don't need to be specific on a deeply nested masterpage then you can transfer that content to the masterpage one above and don't need to provide the nested masterpage with the ability to itself insert content there.
An example: let's say all of your pages use the same footer. Then your topmost masterpage (or template to speak in Umbraco terms) can have a <div id="footer">...</div> section at the bottom which contains the footer, yet it wouldn't contain any ContentPlaceholders as there is no need for a nested template to add anything to the footer.
Now let's assume you have e.g. a shop sub section and you need to insert a special terms and conditions link in the footer (this is just theoretical, probably not the best idea to put the link there). Then you could do something like this on your topmost masterpage:
<div id="footer">
<a href="link1">link1</a>
<a href="link2">link2</a>
<a href="link3">link3</a>
<asp:ContentPlaceHolder ID="FooterPlaceHolder" runat="server"></asp:ContentPlaceHolder>
<a href="linkEnd">linkEnd</a>
</div>
This gives all nested masterpages the option (you don't need to use all of the ContentPlaceholders that the masterpage offers) to insert their own links to the footer at the specified place which you control on the topmost masterpage.
Another example: you have 2 and 3 column layouts. As it is, the 3 column layout is just a specific case of the 2 column layout (depending on the Html markup that might not be true!). So you can have a 2 column masterpage which has a ContentPlaceholder for LeftColumn and another one for RightColumn, then you could set up a 3 column nested masterpage which splits the LeftColumn into 2 ContentPlaceHolders, LeftFirstColumn and LeftSecondColumn. The advantage here is that you can insert the markup that will force the split in the 3 column masterpage so all masterpages who 'inherit' this one don't have to worry about that.
2 column template:
<div id="main">
<div id="leftColumn">
<asp:ContentPlaceHolder ID="LeftColumnPlaceHolder" runat="server"></asp:ContentPlaceHolder>
</div>
<div id="rightColumn">
<asp:ContentPlaceHolder ID="RightColumnPlaceHolder" runat="server"></asp:ContentPlaceHolder>
</div>
</div>
3 column template:
<asp:Content ContentPlaceHolderId="LeftColumnPlaceHolder" runat="server">
<div id="leftFirstColumn">
<h2>this is the left column</h2>
<asp:ContentPlaceHolder ID="LeftFirstColumnPlaceHolder" runat="server"></asp:ContentPlaceHolder>
</div>
<div id="leftSecondColumn">
<h2>this is the middle column</h2>
<asp:ContentPlaceHolder ID="LeftSecondColumnPlaceHolder" runat="server"></asp:ContentPlaceHolder>
</div>
</asp:Content>
<asp:Content ContentPlaceHolderId="RightColumnPlaceHolder" runat="server">
<!-- right column content -->
</asp:Content>
Now, in this case it might not be necessary to provide the RightColumnPlaceHolder here, because the implementation might be the same for both of them, e.g. a dynamically created menu based on the location of the current page in the hierarchy. In this case you can just omit that and insert the call to the macro in the 2 column template so you don't have to insert the same code over and over again in each nested template.
Hope that helps,
Sascha
Thanks, i will rethink the structure of templates with your advices.
i think i broke the page....
posted code here without code window..my bad
so, doing it again.
i have a master template Startsida
and injecting a subtemplate into it called header template
and the subtemplate is
and nothing shows, absolutely nothing. white blank page, with no markup in source whatsoever. i have allowed startsida page document type to use both those templates.
Hi Martin,
this should definitely work. You only need to allow the nested template on the document type. If you still see nothing try to create a new document type with template, add just some text to the template (without doing anything else) and create a content node using that template. If you still can't see anything then something else might be messed up. Let us know!
Cheers,
Sascha
is working on a reply...