/// <summary> /// The appointed theme file url of site /// </summary> /// <param name="frontUrlHelper">The front url helper</param> /// <param name="themeName">the theme</param> /// <param name="relativeUrl">The relative theme file path of site</param> /// <returns></returns> public static IHtmlString ThemeFileUrl(this FrontUrlHelper frontUrlHelper, string baseUri, string themeName, string relativeUrl) { var site = Site.Current; string resourceDomain = site.ResourceDomain; IHtmlString url = new HtmlString(""); if (!string.IsNullOrEmpty(themeName)) { var fileExists = false; var themeFileUrl = ""; do { site = site.AsActual(); Theme theme = new Theme(site, themeName).LastVersion(); themeFileUrl = Kooboo.Web.Url.UrlUtility.Combine(theme.VirtualPath, relativeUrl); var physicalPath = HttpContext.Current.Server.MapPath(themeFileUrl); fileExists = File.Exists(physicalPath); site = theme.Site.Parent; } while (site != null && !fileExists); if (!string.IsNullOrEmpty(resourceDomain)) { baseUri = resourceDomain; } return(new HtmlString(UrlUtility.ToHttpAbsolute(baseUri, themeFileUrl))); } return(frontUrlHelper.ThemeFileUrl(baseUri, relativeUrl)); }