private string renderLayout() { //render layout, panels, and page if (pageType == 1) { //load a Static Page ////////////////// return loadStaticPage(pageService); } else { //load a Dynamic Page ////////////////// var scaffold = new Scaffold(S, "/App/Content/themes/" + websiteTheme + "/layout.html"); //load page(s) from file/cache var pages = loadPage(pageId); //get a list of panels in the layout HTML var panels = loadLayout(scaffold); //add components to layout panels var components = new List<int[,,]>(); for (var x = 0; x < panels.Count; x++) { foreach (var page in pages) { //find components in this page & all page layers //associated with this page that belong to a layout panel foreach (var c in page.components) { if (c.panelId == panels[x].id) { //add component to layout panel cell loadComponent(c, panels[x], panels[x].cells[0]); break; } } } } //finally, render each layout panel //this will force all components & panels within the hierarchy to render as well foreach (var panel in panels) { scaffold.Data["panel-" + panel.id] = panel.Render(); } return scaffold.Render(); } }
public string Render() { //setup page to render layout, panels, and components (and editor UI too if necessary) var scaffold = new Scaffold(S, "/app/core/page.html"); //setup scaffold variables scaffold.Data["favicon"] = "/images/favicon.gif"; scaffold.Data["body-class"] = GetBrowserType() + (S.User.isMobile ? (S.User.isTablet ? " s-tablet" : " s-mobile") : " s-hd"); scaffold.Data["website-css"] = "/content/websites/" + websiteId + "/website.css?v=" + S.Server.Version; scaffold.Data["theme-css"] = "/css/themes/" + websiteTheme + "/theme.css"; scaffold.Data["colors-css"] = "/css/colors/" + websiteColors + ".css"; scaffold.Data["svg-icons"] = S.Server.LoadFileFromCache("/App/Content/themes/" + websiteTheme + "/icons.svg"); //setup base javascript files string min = ""; if (S.Server.environment != Server.enumEnvironment.development) { min = ".min"; } S.javascriptFiles.Add("platform", "/js/platform" + min + ".js"); if (isEditable == true) { S.javascriptFiles.Add("platform", "/js/editor" + min + ".js"); } //render page layout (panels & components) scaffold.Data["body"] = renderLayout(); //setup inline CSS scaffold.Data["head-css"] = S.css.renderCss(); //setup CSS files scaffold.Data["css-files"] = S.cssFiles.renderCssFiles(); //setup inline javascript scaffold.Data["scripts"] = S.javascriptFiles.renderJavascriptFiles(true, S.javascript.renderJavascript()); ; //finally, render web page return scaffold.Render(); }