protected void Page_PreInit(object sender, EventArgs e) { // Default master page file path string masterPageFilePath = "~/themes/" + ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.Theme + "/content/content.master"; //get page id from querystring string _pageName = ""; if (Request.Params["page"] != null) { _pageName = Request.Params["page"]; } else { _pageName = "home"; } //get content page data ContentPage contentPage = ZNodeContentManager.GetPageByName(_pageName); if (contentPage != null) { if (contentPage.MasterPage != null && contentPage.MasterPage != "Default") { string masterFilePath = ZNodeConfigManager.EnvironmentConfig.DataPath + "MasterPages/Content/" + contentPage.MasterPage + ".master"; // Only do the template override operation if the master page file exists if (System.IO.File.Exists(Server.MapPath(masterFilePath))) { // If template master page exists, then override default master page masterPageFilePath = masterFilePath; } } } // Set master page this.MasterPageFile = masterPageFilePath; //add to context for control access HttpContext.Current.Items.Add("PageTitle", contentPage.Title); //SEO stuff ZNodeSEO seo = new ZNodeSEO(); // Set Default SEO Values ZNodeMetaTags tags = new ZNodeMetaTags(); seo.SEOTitle = tags.ContentTitle(contentPage); seo.SEODescription = tags.ContentDescription(contentPage); seo.SEOKeywords = tags.ContentKeywords(contentPage); }
protected void Page_PreInit(object sender, EventArgs e) { if (ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig == null) { throw (new ApplicationException("Could not retrieve site settings from the database. Please check your database connection by browsing to Diagnostics.aspx")); } this.MasterPageFile = "~/themes/" + ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.Theme + "/home/home.master"; //get Home page data ContentPage contentPage = ZNodeContentManager.GetPageByName("home"); //add to context for control access HttpContext.Current.Items.Add("PageTitle", contentPage.Title); //SEO stuff ZNodeSEO seo = new ZNodeSEO(); seo.SEODescription = contentPage.SEOMetaDescription; seo.SEOKeywords = contentPage.SEOMetaKeywords; seo.SEOTitle = contentPage.SEOTitle; //get the user account from session ZNodeUserAccount _userAccount = (ZNodeUserAccount) ZNodeUserAccount.CurrentAccount(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_PreInit(object sender, EventArgs e) { // Default master page file path string masterPageFilePath = "~/themes/" + ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.Theme + "/category/category.master"; // Get Category id from querystring if (Request.Params["zcid"] != null) { _categoryId = int.Parse(Request.Params["zcid"]); } else { throw(new ApplicationException("Invalid Category Request")); } // Retrieve category data ZNodeCategory category = ZNodeCategory.Create(_categoryId, ZNodeConfigManager.SiteConfig.PortalID); if (category != null) { if (category.MasterPage.Length > 0 && category.MasterPage != "Default") { string masterFilePath = ZNodeConfigManager.EnvironmentConfig.DataPath + "MasterPages/category/" + category.MasterPage + ".master"; if (System.IO.File.Exists(Server.MapPath(masterFilePath))) { // If template master page exists, then override default master page masterPageFilePath = masterFilePath; } } } else { Response.Redirect("~/default.aspx"); } // Set master page this.MasterPageFile = masterPageFilePath; // Add to httpContext HttpContext.Current.Items.Add("Category", category); // Set SEO Properties ZNodeSEO seo = new ZNodeSEO(); // Set Default SEO values ZNodeMetaTags tags = new ZNodeMetaTags(); seo.SEOTitle = tags.CategoryTitle(category); seo.SEODescription = tags.CategoryDescription(category); seo.SEOKeywords = tags.CategoryKeywords(category); }
/// <summary> /// Page Pre-Initialization Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_PreInit(object sender, EventArgs e) { // Default master page file path string masterPageFilePath = "~/themes/" + ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.Theme + "/product/Product.master"; // Get product id from querystring if (Request.Params["zpid"] != null) { _productId = int.Parse(Request.Params["zpid"]); } else { throw (new ApplicationException("Invalid Product Id")); } // Retrieve product data _product = ZNodeProduct.Create(_productId, ZNodeConfigManager.SiteConfig.PortalID); if (_product != null) { if (_product.MasterPage.Length > 0 && _product.MasterPage != "Default") { string masterFilePath = ZNodeConfigManager.EnvironmentConfig.DataPath + "MasterPages/product/" + _product.MasterPage + ".master"; if (System.IO.File.Exists(Server.MapPath(masterFilePath))) { // If template master page exists, then override default master page masterPageFilePath = masterFilePath; } } } else { Response.Redirect("~/default.aspx"); } // Set master page this.MasterPageFile = masterPageFilePath; // Add to http context so it can be shared with user controls HttpContext.Current.Items.Add("Product", _product); // Set SEO Properties ZNodeSEO seo = new ZNodeSEO(); // Set SEO default values to the product ZNodeMetaTags tags = new ZNodeMetaTags(); seo.SEOTitle = tags.ProductTitle(_product); seo.SEODescription = tags.ProductDescription(_product); seo.SEOKeywords = tags.ProductKeywords(_product); }