I'm having a bit of troule figuring this one out :-) I have an Umbraco installation which contains two different types of sites which have different layouts. Both sites contains a news section and I'm using the same News list document type/template and News document type/template for this. Consider the following document type structure:
- Site 1
- Site 1 textpage
- Site 2
- Site 2 textpage
- News
- News item
Which leads to the following structure in the content tree:
- Site 1 master
- Site 1 textpage
- News
- News item
- Site 2 master
- Site 2 textpage
- <News template should also be here>
- <News item template should also be here>
Since the News and News item templates are already using the Site 1 master template, they cannot use the Site 2 master template.
Is there any way of doing this without any obscure hacks? ;-)
I'm pretty sure there's a simple few lines of .NET that can swap out Master Templates before the template gets rendered, it was part of the Umbraco/technet talk at codegarden a while back.
Can't remember if the code ever got posted but remember it was pretty simple, hope that helps, sorry I don't have the code!
Thanks a lot for your input :-) That could very well be the solution! I'll have to fool around a bit with it. Guess you have to make sure that the contentplaceholder match then.
I'll try it out and then get back to this post. Thanks again!
Using a template under multiple masterpages
Hi all,
I'm having a bit of troule figuring this one out :-) I have an Umbraco installation which contains two different types of sites which have different layouts. Both sites contains a news section and I'm using the same News list document type/template and News document type/template for this. Consider the following document type structure:
Which leads to the following structure in the content tree:
The template structure then looks like this:
Since the News and News item templates are already using the Site 1 master template, they cannot use the Site 2 master template.
Is there any way of doing this without any obscure hacks? ;-)
Thanks a lot in advance.
- Bo
Hey Bo,
I'm pretty sure there's a simple few lines of .NET that can swap out Master Templates before the template gets rendered, it was part of the Umbraco/technet talk at codegarden a while back.
Can't remember if the code ever got posted but remember it was pretty simple, hope that helps, sorry I don't have the code!
Rich
Quick google found this:
protectedvoidPage_PreInit(object sender,EventArgs e)
{ if()//logic to check which site is being called
this.Page.MasterPageFile = "~/Site1.master";
else
this.Page.MasterPageFile="~/Site2.master";
}
Darn formatting! http://www.codeproject.com/Articles/15479/Changing-Master-Page-at-Runtime
Hi Rich,
Thanks a lot for your input :-) That could very well be the solution! I'll have to fool around a bit with it. Guess you have to make sure that the contentplaceholder match then.
I'll try it out and then get back to this post. Thanks again!
- Bo
is working on a reply...