@functions { public static bool TemplateExists(int templateId) { if (templateId <= 0) { return false; } var template = new umbraco.cms.businesslogic.template.Template(templateId); return template.Alias == "BasePage" || (template.MasterTemplate != 0 && TemplateExists(template.MasterTemplate)); } }
I don't know where the error was exactly, but I did find that Template lives under the umbraco.cms.businesslogic.template namespace which is different from what you have.
razor @functions
Hi all try as I might I can't get the following scenario to work..
What im trying to achieve is a loop through to the closes doctype which has a template and then a redirect..
I'm getting a syntax error stating { expected:
This appears to save without errors:
I don't know where the error was exactly, but I did find that Template lives under the umbraco.cms.businesslogic.template namespace which is different from what you have.
Ah, okay, so the two changes I made to get the script to save without errors are:
Remove the semicolon after:
Include template in the path namespace for:
is working on a reply...