I'm not sure if there are other options than using the altTemplate...but could you make a little description of the scenario where you are in need of this? Maybe it's more easy to give you advice then :-)
I have reapproached the problem and perhaps using altTemapltes via the url i.e. mysite.com/about/mytemplate.aspx rather than mysite.com/about.aspx?altTemplate=mytemplate would be okay. However my problem now is how to detect which tempalte is being used. If i use
var t = new umbraco.template(currentPage.template);
this just returns the default tempalte for the page not the tempalte currently being used to render the page. So I have no way to detect which template is currently being used to render the page, this means that if a desktop browser trys to access a mobile url I have no way to redirect them to the web version.
Dynamicaly Choose Page Template
Hey All,
Is there a way to dynamicaly choose which template a page renders without having to resort to using the altTemplate query string?
L
Hi Lachlann
I'm not sure if there are other options than using the altTemplate...but could you make a little description of the scenario where you are in need of this? Maybe it's more easy to give you advice then :-)
/Jan
Hi Jan,
I have reapproached the problem and perhaps using altTemapltes via the url i.e. mysite.com/about/mytemplate.aspx rather than mysite.com/about.aspx?altTemplate=mytemplate would be okay. However my problem now is how to detect which tempalte is being used. If i use
var t = new umbraco.template(currentPage.template);
this just returns the default tempalte for the page not the tempalte currently being used to render the page. So I have no way to detect which template is currently being used to render the page, this means that if a desktop browser trys to access a mobile url I have no way to redirect them to the web version.
does that make sense.
thanks for your help
L
Okay, just after i posted this i found this post
http://our.umbraco.org/forum/templating/templates-and-document-types/4506-How-to-get-the-Template-ID-of-the-Rendered-Alternate-Template
this lets me get the name of the altTemplate if it is used.
L
Okay, just after i posted this i found this post
http://our.umbraco.org/forum/templating/templates-and-document-types/4506-How-to-get-the-Template-ID-of-the-Rendered-Alternate-Template
this lets me get the name of the altTemplate if it is used.
L
is working on a reply...