public override XVar set_template(dynamic _param_template) { XVar template = _param_template.Clone(); XVar templatesPath; templatesPath = ""; if (MVCFunctions.substr(template, 0, 1) == "/") { template = MVCFunctions.substr(template, 1); } this.template_file = template.Replace("/", "_").Replace(".cshtml", "").Replace(".htm", ""); set_layout(); if (this.mobileTemplateMode()) { templatesPath = "Mobile/"; } view_filename = ""; // try to locate template file if (MVCFunctions.file_exists(MVCFunctions.Concat("Views/", MVCFunctions.Concat(templatesPath, template)))) { view_filename = MVCFunctions.Concat(templatesPath, template); } else if (MVCFunctions.file_exists(MVCFunctions.Concat("Views/", MVCFunctions.Concat(templatesPath, "Global/", template)))) { view_filename = MVCFunctions.Concat(templatesPath, "Global/", template); } else if (MVCFunctions.file_exists(MVCFunctions.Concat("Views/", template.Replace("_", "/")))) { view_filename = template.Replace("_", "/"); } else if (MVCFunctions.file_exists(MVCFunctions.Concat("Views/Shared/", template.Replace(".htm", ".cshtml")))) { view_filename = MVCFunctions.Concat("Shared/", template.Replace(".htm", ".cshtml")); } if (view_filename != "") { this.template = MVCFunctions.myfile_get_contents(MVCFunctions.getabspath(MVCFunctions.Concat("Views/", view_filename)), "r"); } view_filename = view_filename.Replace(".cshtml", ""); assign_headers(); return(null); }