protected void Page_Load(object sender, EventArgs e) { //if (!this.Page.IsPostBack) //{ //} this.Page.Title = "XXXXXX"; Model_SiteInfo st = new Model_SiteInfo(); Model_MainSetting setting = new Model_MainSetting(); setting = setting.GetMainSetting(); Model_PageEngine PageEngine = new Model_PageEngine(); PageEngine.SiteInfo = st.GetSiteInfo(); Master.PageEngine = PageEngine; //Master.SiteInfo = st.GetSiteInfo(); //Model_MainSetting s = new Model_MainSetting(); Model_Post post = new Model_Post(); string PageSlug = Page.RouteData.Values["PageSlug"] as string; string archive = Page.RouteData.Values["archive"] as string; string slug = Page.RouteData.Values["slug"] as string; if (!string.IsNullOrEmpty(PageSlug)) { string post_slug = PageSlug; content.Text = ""; } if (string.IsNullOrEmpty(PageSlug) && string.IsNullOrEmpty(archive) && string.IsNullOrEmpty(slug)) { string post_slug = string.Empty; int post_id = setting.HomePagePostID; post = post.GetPostByID(post_id); if (post != null) { post_slug = post.Slug; HeaderSection.Text = GenerateHeaderBannerAndSlider(post); content.Text = post.BodyContent; // string[] dd = { "fixed-sidebar", "no-skin-config", "full-height-layout" }; //StyleCore dd = new StyleCore(); //StyleCore.arrayClass = dd; } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { Social s = new Social(); dropSocial.DataSource = s.GetSocialList(); dropSocial.DataTextField = "Title"; dropSocial.DataValueField = "SocialID"; dropSocial.DataBind(); ListItem l = new ListItem("Select", "0"); dropSocial.Items.Insert(0, l); Model_SiteInfo ms = new Model_SiteInfo(); ms = ms.GetSiteInfo(); if (ms != null) { s_address.Text = ms.Address; s_phone.Text = ms.Phone; s_Email.Text = ms.Email; s_fax.Text = ms.Fax; s_lat.Text = ms.Lat; s_long.Text = ms.Long; lblLogoTop.Value = ms.LogoTopUrl; lblLogoFoot.Value = ms.LogoFootUrl; lblFavIcon.Value = ms.FavIcon; lblBrochure.Value = ms.MainBrochure; s_slocan.Text = ms.Slogan; s_about.Text = ms.FooterAbout; s_googleanlytic.Text = ms.GoogleAnalytic; s_MapScript.Text = ms.MapScript; Model_SiteSocialMap ss = new Model_SiteSocialMap(); dropSocial_ret.DataSource = ss.GetSocialMap(ms.IFID); dropSocial_ret.DataTextField = "Link"; dropSocial_ret.DataValueField = "SocialID"; dropSocial_ret.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { //Response.Write(HttpUtility.UrlDecode(Request.Url.AbsolutePath)));Response.End(); if (!this.Page.IsPostBack) { string Pagetitle = string.Empty; string Pagedescription = string.Empty; string canonical = string.Empty; string fb_localte = string.Empty; string fb_type = string.Empty; string fb_title = string.Empty; string fb_des = string.Empty; string fb_url = string.Empty; string fb_site_name = string.Empty; string fb_image = string.Empty; string tw_card = string.Empty; string tw_title = string.Empty; string tw_des = string.Empty; string tw_image = string.Empty; string analytic = string.Empty; bool Metarobotfollow = false; Model_SiteInfo st = new Model_SiteInfo(); Model_MainSetting setting = new Model_MainSetting(); setting = setting.GetMainSetting(); Model_PageEngine PageEngine = new Model_PageEngine(); PageEngine.SiteInfo = st.GetSiteInfo(); PageEngine.MainSetting = setting; Model_PostType cPostType = new Model_PostType(); Model_Post post = new Model_Post(); Model_Menu m = new Model_Menu(); Model_PostTaxonomy tax = new Model_PostTaxonomy(); List <Model_Post> postArchive = new List <Model_Post>(); Model_Archive archive = new Model_Archive(); PageEngine.NavMenu = m.GetMenuAll(1); PageEngine.FooterMenu = m.GetMenuAll(2); //string[] dd = { "fixed-sidebar", "no-skin-config", "full-height-layout" }; //StyleCore dd = new StyleCore(); //StyleCore.arrayClass = dd; //Set Setting to MasterPage Class Master.PageEngine = PageEngine; byte bytPostTypeID = 0; string StrPost_slug = string.Empty; int intPostID = 0; string RouteSlug_1 = Page.RouteData.Values["Param1"] as string; string RouteSlug_2 = Page.RouteData.Values["Param2"] as string; string RouteSlug_3 = Page.RouteData.Values["Param3"] as string; string RouteSlug_4 = Page.RouteData.Values["Param4"] as string; string RouteSlug_5 = Page.RouteData.Values["Param5"] as string; Model_PostCustomItem pct = new Model_PostCustomItem(); //Case Route Slug if (!string.IsNullOrEmpty(RouteSlug_1)) { //1. Check Is Archive archive = archive.GetPostArchive(RouteSlug_1); if (archive != null) { //Is Archive bytPostTypeID = archive.PostTypeID; StrPost_slug = (string.IsNullOrEmpty(archive.Slug) ? archive.PostTypeSlug : archive.Slug); //postArchive = CmsController.GetPostArchive(bytPostTypeID); //Check PostType Archive switch (StrPost_slug) { case "hotelworld-products": //check Route Param2 if (string.IsNullOrEmpty(RouteSlug_2)) { //Case Product Page Archive SectionProductArchive.Visible = true; cPostType = cPostType.GetPostTypeBySlug(StrPost_slug); if (cPostType != null) { //product-type = 24 this.TaxForPostType = tax.FrontGetTaxonomyByID(24); if (this.TaxForPostType != null) { this.TaxList = tax.FrontGetTaxonomyByRefID(24); } } } else { //check Is Paging of Product Page Archive if (RouteSlug_2 == "page") { //Case Archive Paging SectionProductArchive.Visible = true; string pageno = RouteSlug_3; } else if (RouteSlug_2 == "category" || RouteSlug_2 == "tag") { //Tax Archive tax = tax.GetTaxBySlugAndPostType(RouteSlug_3, bytPostTypeID); if (tax != null) { //case Tax approve SectionProductTaxArchive.Visible = true; this.TaxForPostType = tax; this.TaxList = tax.GetTaxonomyTaxTypeAndPostType_withcountpost(bytPostTypeID, (byte)PostTaxonomyType.Categories); this.ContentBody = tax.BodyContent; //Case tax Archive Paging if (RouteSlug_4 == "page") { string pageno = RouteSlug_5; //Do something with paging } } } else { //Check Product SinglePage post = CmsController.GetPostSlug(RouteSlug_2, PostType.Products); if (post != null) { SectionProductSingle.Visible = true; this.PostDataUI = post; this.ContentBody = post.BodyContent; this.PageContentTitle = post.Title; this.CTF = pct.GetItemCustomByPostID(post.PostID); } } } break; case "ข่าวสาร": //check Route Param2 if (string.IsNullOrEmpty(RouteSlug_2)) { //Case Product Page Archive SectionBlogPageArchive.Visible = true; } else { //check Is Paging of Product Page Archive if (RouteSlug_2 == "page") { //Case Archive Paging SectionBlogPageArchive.Visible = true; string pageno = RouteSlug_3; } else if (RouteSlug_2 == "category" || RouteSlug_2 == "tag") { //Tax Archive tax = tax.GetTaxBySlugAndPostType(RouteSlug_3, bytPostTypeID); if (tax != null) { //case Tax approve //Same layout with blog archive // SectionBlogPageTaxArchive.Visible = true; SectionBlogPageArchive.Visible = true; //Case tax Archive Paging if (RouteSlug_4 == "page") { string pageno = RouteSlug_5; //Do something with paging } } } else { //Check Product SinglePage post = CmsController.GetPostSlug(RouteSlug_2, PostType.Blog); if (post != null) { SectionBlogPageSingle.Visible = true; } } } break; } HeaderSection.Text = GenerateHeaderBannerAndSlider(post, tax); } else { //Case PostType Page StrPost_slug = RouteSlug_1; post = CmsController.GetPostSlug(StrPost_slug, PostType.Pages); if (post != null) { bytPostTypeID = post.PostTypeID; intPostID = post.PostID; //page_header.Visible = true; if (StrPost_slug == "checkout") { section_checkout_page.Visible = true; } else { page_content.Visible = true; } HeaderSection.Text = GenerateHeaderBannerAndSlider(post); this.PostDataUI = post; this.ContentBody = post.BodyContent; this.PageContentTitle = post.Title; } } // content.Text = post.BodyContent; } else { //Case HomePage No Slug //Get PostID From Setting HomePage Slug intPostID = setting.HomePagePostID; post = CmsController.GetPostByID(intPostID); if (post != null) { StrPost_slug = post.Slug; bytPostTypeID = post.PostTypeID; HeaderSection.Text = GenerateHeaderBannerAndSlider(post); this.CTF = pct.GetItemCustomByPostID(intPostID); // content.Text = post.BodyContent; this.PostDataUI = post; this.ContentBody = post.BodyContent; this.PageContentTitle = post.Title; section_page_home.Visible = true; home_content.Text = this.ContentBody; } } //= null; Model_PostSeo posttype_postseo = new Model_PostSeo(); Model_PostSeo tax_postseo = new Model_PostSeo(); Model_PostSeo post_postseo = new Model_PostSeo(); if (bytPostTypeID != 0) { cPostType = cPostType.GetPostTypeByID(bytPostTypeID); posttype_postseo = cPostType.PosTypetSEO; } if (tax != null) { tax_postseo = tax.TaxSEO; } if (post != null) { post_postseo = post.PostSEO; } Pagetitle = checklv(posttype_postseo, tax_postseo, post_postseo, "SEOTitle"); Pagedescription = checklv(posttype_postseo, tax_postseo, post_postseo, "MetaDescription"); canonical = checklv(posttype_postseo, tax_postseo, post_postseo, "CanonicalUrl"); fb_localte = setting.htmlTagSiteLang; fb_type = "website"; fb_title = checklv(posttype_postseo, tax_postseo, post_postseo, "FaceBookTitle"); fb_des = checklv(posttype_postseo, tax_postseo, post_postseo, "FacebookDescription"); fb_url = Request.Url.ToString(); fb_site_name = PageEngine.SiteInfo.Slogan; fb_image = checklv(posttype_postseo, tax_postseo, post_postseo, "FacebookImage"); tw_card = "summary"; tw_title = checklv(posttype_postseo, tax_postseo, post_postseo, "TwitterTitle"); tw_des = checklv(posttype_postseo, tax_postseo, post_postseo, "TwitterDescription"); tw_image = checklv(posttype_postseo, tax_postseo, post_postseo, "TwitterImages"); analytic = checklv(posttype_postseo, tax_postseo, post_postseo, "GoogleAnalytic"); Metarobotfollow = checklv_bool(posttype_postseo, tax_postseo, post_postseo, "Metarobotsfollow"); this.Page.Title = string.IsNullOrEmpty(Pagetitle) ? setting.WebSiteTitle : Pagetitle; var MetaDescription = new HtmlMeta { Name = "description", Content = Pagedescription }; Header.Controls.Add(MetaDescription); var MetaFB_locate = new HtmlMeta { Name = "og:locale", Content = fb_localte }; Header.Controls.Add(MetaFB_locate); var MetaFB_Type = new HtmlMeta { Name = "og:type", Content = fb_type }; Header.Controls.Add(MetaFB_Type); var MetaFB_title = new HtmlMeta { Name = "og:title", Content = !string.IsNullOrEmpty(fb_title)? fb_title : string.IsNullOrEmpty(Pagetitle) ? setting.WebSiteTitle : Pagetitle }; Header.Controls.Add(MetaFB_title); var MetaFB_Des = new HtmlMeta { Name = "og:description", Content = !string.IsNullOrEmpty(fb_des) ? fb_des: Pagedescription }; Header.Controls.Add(MetaFB_Des); var MetaFB_Url = new HtmlMeta { Name = "og:url", Content = fb_url }; Header.Controls.Add(MetaFB_Url); var MetaFB_SiteName = new HtmlMeta { Name = "og:site_name", Content = fb_site_name }; Header.Controls.Add(MetaFB_SiteName); var MetaFB_image = new HtmlMeta { Name = "og:image", Content = fb_image }; Header.Controls.Add(MetaFB_image); var MetaTW_Card = new HtmlMeta { Name = "twitter:card", Content = tw_card }; Header.Controls.Add(MetaTW_Card); var MetaTW_Des = new HtmlMeta { Name = "twitter:description", Content = tw_des }; Header.Controls.Add(MetaTW_Des); var MetaTW_Title = new HtmlMeta { Name = "twitter:title", Content = tw_title }; Header.Controls.Add(MetaTW_Title); var Meta_Image = new HtmlMeta { Name = "twitter:image", Content = tw_image }; Header.Controls.Add(Meta_Image); } }