private void SetFooterLinks() { List<Item> links = currentItem.FooterLinks.ListItems; if (links == null || links.Count < 1) { links = new LandingPageItem(currentItem.InnerItem.Parent).FooterLinks.ListItems; } System.Text.StringBuilder markupBuilderSub = new System.Text.StringBuilder(); foreach (Item item in links) { PageSummaryItem psItem = new PageSummaryItem(item); if (!string.IsNullOrEmpty(psItem.NavigationTitle.Text)) { string url = Sitecore.Links.LinkManager.GetItemUrl(psItem.InnerItem); markupBuilderSub.AppendFormat(@" <strong>/</strong> <a href=""{0}"">{1}</a>", url, psItem.NavigationTitle.Rendered); } } if (markupBuilderSub.Length > 0) { footerLinks = markupBuilderSub.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { LandingPageItem currentLanding = null; if(currentItem!=null) currentLanding = new LandingPageItem(currentItem.InnerItem.Parent); if (currentLanding != null) { Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions(); urlOptions.AlwaysIncludeServerUrl = true; urlOptions.AddAspxExtension = false; urlOptions.LanguageEmbedding = LanguageEmbedding.Never; OriginalReferer = currentLanding.UrlToTweet.Rendered; TwitterShareText = currentItem.TwitterShareText.Rendered; FacebookShareText = currentItem.FacebookShareText.Rendered; GoogleShareText = currentItem.GooglePlusShareText.Rendered; if (currentItem.InnerItem.Parent != null) { TwitterUsername = new LandingPageItem(currentItem.InnerItem.Parent).Username.Rendered; } } }
private void CheckIfProfileProvided() { string profile = string.Empty; profile = WebUtil.GetQueryString("_profile"); //Get User from Session //Check Session User objUser = new User(); if (Session["sess_User_landing"] != null) { objUser = (User)Session["sess_User_landing"]; profile = objUser.BrowsingHistory.LandingProfile; } if (!String.IsNullOrEmpty(profile)) { Item profileItem = SitecoreHelper.GetContextLandingItem(currentItem, profile); if (profileItem != null) { currentItem = profileItem; } } HtmlGenericControl BodyTag = (HtmlGenericControl)this.Page.FindControl("BodyTag"); BodyTag.Attributes.Add("data-landing", currentItem.ID.ToShortID().ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //If twitter heading/media item is not present ie field is not there on the child template then pick up the value from parent template. if (String.IsNullOrEmpty(currentItem.TwitterHeading.Rendered)) TwitterHeading = new LandingPageItem(currentItem.InnerItem.Parent).TwitterHeading.Rendered; else TwitterHeading = currentItem.TwitterHeading.Rendered; if (String.IsNullOrEmpty(currentItem.Username.Rendered)) TwitterUsername = new LandingPageItem(currentItem.InnerItem.Parent).Username.Rendered; else TwitterUsername = currentItem.Username.Rendered; if (currentItem.InnerItem.TemplateID.ToString() == Settings.LandingPagesWhatsNextTemplate) { phTwitterHeading.Visible = true; } else phTwitterHeading.Visible = false; if (String.IsNullOrEmpty(currentItem.Image.MediaUrl)) { TwitterImage = new LandingPageItem(currentItem.InnerItem.Parent).Image.MediaUrl; } else { TwitterImage = currentItem.Image.MediaUrl; } SetTweets(); } }
private void CheckIfProfileProvided() { string profile = string.Empty; profile = WebUtil.GetQueryString("_profile"); //Get User from Session //Check Session User objUser = new User(); if (Session["sess_User_landing"] != null) { objUser = (User)Session["sess_User_landing"]; profile = objUser.BrowsingHistory.LandingProfile; } if (!String.IsNullOrEmpty(profile)) { Item profileItem = SitecoreHelper.GetContextLandingItem(currentItem, profile); if (profileItem != null) { currentItem = profileItem; } } }
private void SetSitecoreData() { //Get User from Session //Check Session User objUser = new User(); if (Session["sess_User_landing"] != null) { objUser = (User)Session["sess_User_landing"]; clubId = objUser.BrowsingHistory.LandingClubID; profile = objUser.BrowsingHistory.LandingProfile; region = objUser.BrowsingHistory.LandingRegion; } //Set currentLanding item if (currentItem != null) { currentLanding = currentItem.InnerItem.Parent; } if (currentLanding != null) btnSubmit.Attributes.Add("data-gaqlabel", currentLanding.LandingBase.LandingId.Rendered); //Get Club Data if (!String.IsNullOrEmpty(clubId)) clubItem = SitecoreHelper.GetClubOnClubId(clubId); if (clubItem != null) { //Image Carousel List<MediaItem> imageList; if (!String.IsNullOrEmpty(clubItem.Imagegallery.Raw)) { imageList = clubItem.Imagegallery.ListItems.ConvertAll(X => new MediaItem(X)); ClubImages.DataSource = imageList; ClubImages.DataBind(); } System.Text.StringBuilder markupBuilder; markupBuilder = new System.Text.StringBuilder(); markupBuilder.Append(clubItem.Addressline1.Rendered); markupBuilder.Append(!String.IsNullOrEmpty(clubItem.Addressline2.Rendered) ? ", " + clubItem.Addressline2.Rendered : ""); markupBuilder.Append(!String.IsNullOrEmpty(clubItem.Addressline3.Rendered) ? ", " + clubItem.Addressline3.Rendered : ""); markupBuilder.Append(!String.IsNullOrEmpty(clubItem.Addressline4.Rendered) ? ", " + clubItem.Addressline4.Rendered : ""); markupBuilder.Append(", " + clubItem.Postcode.Rendered); markupBuilder.Append(" | " + clubItem.Salestelephonenumber.Rendered); litClubAddress.Text = markupBuilder.ToString(); Item timetableItem = clubItem.InnerItem.Axes.SelectSingleItem(String.Format("child::*[@@name='{0}']", Settings.TimetableSectionName.ToLower())); //clubItem.InnerItem.Axes.SelectSingleItem(String.Format("descendant::*[@@name='{0}']", Settings.TimetableSectionName)); if (timetableItem != null) { Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions(); urlOptions.AlwaysIncludeServerUrl = true; urlOptions.AddAspxExtension = false; urlOptions.LanguageEmbedding = LanguageEmbedding.Never; string timetableUrl = Sitecore.Links.LinkManager.GetItemUrl(timetableItem, urlOptions); TimeTableUrl = timetableUrl; } } }
private void SetTweets() { List<TwitterFeed> tweets = null; string username =string.Empty; if (String.IsNullOrEmpty(currentItem.Username.Rendered)) { username = new LandingPageItem(currentItem.InnerItem.Parent).Username.Rendered; } else { username = currentItem.Username.Rendered; } tweets = TwitterHelper.GetLatestFavouriteTweets(username); List<TwitterList> twitterList = new List<TwitterList>(); if (tweets != null && tweets.Count > 0) { foreach (TwitterFeed feed in tweets) { string[] tweetWords = feed.FeedDescription.Split(' '); TwitterList tList = new TwitterList(); StringBuilder tDesc = new StringBuilder(); foreach (string str in tweetWords) { string newStr = str; if (str.StartsWith("@") || str.StartsWith("#")) { newStr = str.Replace(str, "<a href='http://twitter.com/" + str + "' target='_blank'>" + str + "</a>"); } if (str.EndsWith(":")) newStr = string.Empty; if(str.StartsWith("http://") || str.StartsWith("https://")) { newStr = str.Replace(str, "<a href='" + str + "' target='_blank'>" + str + "</a>"); } tDesc.Append(newStr + " "); } tList.Tweet = tDesc.ToString(); tList.FavUserName = "******" + feed.FeedDescription.Split(':').First(); tList.UserLink = "http://twitter.com/" + tList.FavUserName; twitterList.Add(tList); } repTweets.DataSource = twitterList; repTweets.DataBind(); } }
private void SetSitecoreData() { //clubId = WebUtil.GetQueryString("_clubid"); //profile = WebUtil.GetQueryString("_profile"); //Get User from Session //Check Session User objUser = new User(); if (Session["sess_User_landing"] != null) { objUser = (User)Session["sess_User_landing"]; clubId = objUser.BrowsingHistory.LandingClubID; profile = objUser.BrowsingHistory.LandingProfile; region = objUser.BrowsingHistory.LandingRegion; } //Get Club Data if (!String.IsNullOrEmpty(clubId)) clubItem = SitecoreHelper.GetClubOnClubId(clubId); if (clubItem != null) { //Get Personal Membership Item MembershipListingItem membership = clubItem.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant::*[@@tid = '{0}']", MembershipListingItem.TemplateId)); if (membership != null) { membershipTeaser = membership.MembershipTeaser.Rendered; } //ltButtonText.Text = String.Format(ltButtonText.Text, "in " + clubItem.Clubname.Rendered + " "); //ltCallToAction.Text = String.Format(ltCallToAction.Text, clubItem.Clubname.Rendered + " "); } if (!String.IsNullOrEmpty(profile)) { //Get Profile Landing Data currentLanding = SitecoreHelper.GetContextLandingItem(currentItem, profile); } else { currentLanding = currentItem.InnerItem.Axes.SelectSingleItem(String.Format("ancestor-or-self::*[@@tid='{0}']", LandingPageItem.TemplateId)); } HtmlGenericControl BodyTag = (HtmlGenericControl)this.Page.FindControl("BodyTag"); BodyTag.Attributes.Add("data-landing", currentItem.ID.ToShortID().ToString()); }