Alternate Template Based On DocType Programatic Solution
Hi i was exploring an apporach to change a template based on a doctype and url request in the form of a querystring arg or the like..
I have a scenario where I'd like to alternately assign a template based on doctype
Say for example I have a Node called Cows which has a master page called Cows (which contains a usual html page)
what I'd like to do is if I had a url request for /Cows?alttemplate=ajax or /Cows/ajax
instead of applying the default alt template logic.. It would do the following:
1. Look for a template called Cows_ajax.aspx if it can't find that look for ajax
I wanted to do that in the hopes of having specific alternate templates without having to know what to assign alt template links to...
this differs from the alttemplate functionality in that it would allow us to do something like Cows/json and spit back the json content or Cows/ajax and just return part of a template for ajax loading etc.
The approach we've considered so far is:
1. Keep the alt template functionality as is and then use a big switch statement per page to load alternative layouts in via cshtml includes for simpler version of the page
2. Modify the default.aspx.cs file in the umbraco core and perform checks programatically that follow the above suggested convention.
any thoughts/ideas would be great.. I never like hacking the core because it means with every version change it means maintenance.
Alternate Template Based On DocType Programatic Solution
Hi i was exploring an apporach to change a template based on a doctype and url request in the form of a querystring arg or the like..
I have a scenario where I'd like to alternately assign a template based on doctype
Say for example I have a Node called Cows which has a master page called Cows (which contains a usual html page)
what I'd like to do is if I had a url request for /Cows?alttemplate=ajax or /Cows/ajax
instead of applying the default alt template logic.. It would do the following:
1. Look for a template called Cows_ajax.aspx if it can't find that look for ajax
I wanted to do that in the hopes of having specific alternate templates without having to know what to assign alt template links to...
this differs from the alttemplate functionality in that it would allow us to do something like Cows/json and spit back the json content or Cows/ajax and just return part of a template for ajax loading etc.
The approach we've considered so far is:
1. Keep the alt template functionality as is and then use a big switch statement per page to load alternative layouts in via cshtml includes for simpler version of the page
2. Modify the default.aspx.cs file in the umbraco core and perform checks programatically that follow the above suggested convention.
any thoughts/ideas would be great.. I never like hacking the core because it means with every version change it means maintenance.
is working on a reply...