We have a big website with different channels. The channel design changes from year to year and from channel to channel but the document types should stay the same. How can I reuse my current document types?
It would be no problem for us to define a separate template on the root level.
The problem is that a lot of editors are working with this website and they don't want to change the template when they create, for example, a new news entry. Can I set the template dynamically or programmatically based on the chosen root template or is there a better/other approach?
First, it looks unaesthetic even when you do it via directory url (www.your.url/name_of_alt_template/) and second, the url structure changes (www.channel1.com/games will be www.channel2.com/games/name_of_alt_template/)
I was talking about changing the Master template on the fly, so not using the Umbraco event model. The code is in that video somewhere, I think he shows it at the end.
Reuse Document Types with different Templates
We have a big website with different channels. The channel design changes from year to year and from channel to channel but the document types should stay the same. How can I reuse my current document types?
It would be no problem for us to define a separate template on the root level.
The problem is that a lot of editors are working with this website and they don't want to change the template when they create, for example, a new news entry. Can I set the template dynamically or programmatically based on the chosen root template or is there a better/other approach?
If you're using 4.10 or higher you could use route hijacking and return a different view in the controller.
Jeroen
We have version 4.11.8. But everything is based on web forms.
Hey Tobias,
You could use AltTemplate http://www.nibble.be/?p=42
Rich
Thank you but we can't use this feature.
First, it looks unaesthetic even when you do it via directory url (www.your.url/name_of_alt_template/) and
second, the url structure changes (www.channel1.com/games will be www.channel2.com/games/name_of_alt_template/)
You can also swap out the Master template via code, this was a couple of lines of .NET code if I remember rightly.
Rich
Comment author was deleted
Yeah just set the correct template if it depends on the template set on parent docs, shouldn't be that hard using the event model
Is there a best practice to do something like this?
I wouldn't say there's best practice, the ability to swap the master page is a feature of .NET
Microsoft use this with Umbraco on TechNet etc. see this video around 27 mins http://stream.umbraco.org/video/2098743/multi-environment-team-based
Rich
Ok - thank you.
So Tim is speaking about the event model of ASP.NET and not of Umbraco?
Comment author was deleted
No in my case I was talking about the event model in Umbraco :)
Comment author was deleted
Here is a snippet but that uses the old API http://our.umbraco.org/wiki/reference/api-cheatsheet/attaching-document-event-handlers/change-the-document's-template but guess that's ok since you are on v4
I was talking about changing the Master template on the fly, so not using the Umbraco event model. The code is in that video somewhere, I think he shows it at the end.
That's what I expected. :-)
So there are obviously two different approaches. Has anybody out there any experience with one or both?
Here is a technique where I download the content of another template and display it on the current template: http://our.umbraco.org/forum/developers/extending-umbraco/13984-Url-rewrite-to-make-website-ajax-crawlable#comment51666
That's another solution I think ;-).
Jeroen
They do two completly different things
1) Change the master doc type on the fly (no changes to Umbraco) this just presents the node using a different Master template.
2) Change the template after you've saved a DocType
From your scenario, I expect 1 would be more useful, you can build business rules into your c#, for example, if year is 2013 then use 2013.master etc.
is working on a reply...