private void WriteTopics(StringBuilder sb, TopicCollection topicCollection) { foreach (Topic topic in topicCollection) { LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.TopicId, NopContext.Current.WorkingLanguage.LanguageId); if (localizedTopic != null) { sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", SEOHelper.GetTopicUrl(localizedTopic.TopicId, localizedTopic.Title), (String.IsNullOrEmpty(localizedTopic.Title) ? localizedTopic.TopicId.ToString() : Server.HtmlEncode(localizedTopic.Title))); } } }
private void WriteTopics() { TopicCollection topics = TopicManager.GetAllTopics(); foreach (Topic topic in topics) { LocalizedTopicCollection localizedTopics = TopicManager.GetAllLocalizedTopics(topic.Name); if (localizedTopics.Count > 0) { //UNDONE add topic of one language only (they have the same URL now) LocalizedTopic localizedTopic = localizedTopics[0]; string url = SEOHelper.GetTopicUrl(localizedTopic.TopicID, localizedTopic.Title); UpdateFrequency updateFrequency = UpdateFrequency.weekly; DateTime updateTime = localizedTopic.UpdatedOn; WriteUrlLocation(url, updateFrequency, updateTime); } } }
private void WriteTopics() { var topics = TopicManager.GetAllTopics(); foreach (Topic topic in topics) { var localizedTopics = TopicManager.GetAllLocalizedTopics(topic.Name); if (localizedTopics.Count > 0) { //UNDONE add topic of one language only (they have the same URL now) var localizedTopic = localizedTopics[0]; var url = SEOHelper.GetTopicUrl(localizedTopic.TopicId, localizedTopic.Title); var updateFrequency = UpdateFrequency.Weekly; var updateTime = localizedTopic.UpdatedOn; WriteUrlLocation(url, updateFrequency, updateTime); } } }
private void WriteTopics() { var topics = IoC.Resolve <ITopicService>().GetAllTopics(); topics = topics.FindAll(t => t.IncludeInSitemap); foreach (Topic topic in topics) { var localizedTopics = IoC.Resolve <ITopicService>().GetAllLocalizedTopics(topic.Name); if (localizedTopics.Count > 0) { //UNDONE add topic of one language only (they have the same URL now) var localizedTopic = localizedTopics[0]; var url = SEOHelper.GetTopicUrl(localizedTopic.TopicId, localizedTopic.Title); var updateFrequency = UpdateFrequency.Weekly; var updateTime = localizedTopic.UpdatedOn; WriteUrlLocation(url, updateFrequency, updateTime); } } }
private void BindData() { Language language = LanguageManager.GetLanguageById(this.LanguageId); Topic topic = TopicManager.GetTopicById(this.TopicId); if (language != null && topic != null) { this.lblLanguage.Text = language.Name; this.lblTopic.Text = topic.Name; LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, this.LanguageId); if (localizedTopic != null) { this.txtTitle.Text = localizedTopic.Title; string topicURL = SEOHelper.GetTopicUrl(localizedTopic.TopicId, localizedTopic.Title); this.hlURL.NavigateUrl = topicURL; this.hlURL.Text = topicURL; this.txtBody.Content = localizedTopic.Body; this.pnlCreatedOn.Visible = true; this.pnlUpdatedOn.Visible = true; this.lblCreatedOn.Text = DateTimeHelper.ConvertToUserTime(localizedTopic.CreatedOn).ToString(); this.lblUpdatedOn.Text = DateTimeHelper.ConvertToUserTime(localizedTopic.UpdatedOn).ToString(); this.txtMetaKeywords.Text = localizedTopic.MetaKeywords; this.txtMetaDescription.Text = localizedTopic.MetaDescription; this.txtMetaTitle.Text = localizedTopic.MetaTitle; } else { this.DeleteButton.Visible = false; this.pnlCreatedOn.Visible = false; this.pnlUpdatedOn.Visible = false; } } else { Response.Redirect("Topics.aspx"); } }
private SiteMapNode ChangeTopicMap(SiteMapResolveEventArgs e) { SiteMapNode currentNode = null; try { currentNode = e.Provider.FindSiteMapNode("~/Sitemap-Topics.aspx").Clone(true); LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(this.TopicId, NopContext.Current.WorkingLanguage.LanguageID); if (localizedTopic != null) { currentNode.Url = SEOHelper.GetTopicUrl(TopicId, localizedTopic.Title); currentNode.Description = localizedTopic.Title; currentNode.Title = localizedTopic.Title; } } catch { } return(currentNode); }
protected void rptrLanguageDivs_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var txtTitle = (TextBox)e.Item.FindControl("txtTitle"); var txtBody = (FCKeditor)e.Item.FindControl("txtBody"); var pnlUrl = (HtmlTableRow)e.Item.FindControl("pnlUrl"); var hlUrl = (HyperLink)e.Item.FindControl("hlUrl"); var lblLanguageId = (Label)e.Item.FindControl("lblLanguageId"); int languageId = int.Parse(lblLanguageId.Text); if (this.TopicId > 0) { var content = this.TopicService.GetLocalizedTopic(this.Topic.Name, languageId); if (content != null) { txtTitle.Text = content.Title; txtBody.Value = content.Body; pnlUrl.Visible = true; string url = SEOHelper.GetTopicUrl(content.TopicId, content.Title, false); hlUrl.Text = url; hlUrl.NavigateUrl = url; } else { pnlUrl.Visible = false; } } else { pnlUrl.Visible = false; } } }
protected void BindData() { //topics var sitemapTopics = new List <SitemapTopic>(); var topics = TopicManager.GetAllTopics(); topics = topics.FindAll(t => t.IncludeInSitemap); foreach (var topic in topics) { LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.TopicId, NopContext.Current.WorkingLanguage.LanguageId); if (localizedTopic != null && !String.IsNullOrEmpty(localizedTopic.Title)) { string topicURL = SEOHelper.GetTopicUrl(localizedTopic.TopicId, localizedTopic.Title); string topicName = localizedTopic.Title; sitemapTopics.Add(new SitemapTopic() { Name = topicName, Url = topicURL }); } } //other pages string otherPages = SettingManager.GetSettingValue("Sitemap.OtherPages"); if (!String.IsNullOrEmpty(otherPages)) { string[] pages = otherPages.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string page in pages) { sitemapTopics.Add(new SitemapTopic() { Name = page, Url = string.Format("{0}{1}", CommonHelper.GetStoreLocation(), page.Trim()) }); } } if (sitemapTopics.Count > 0) { dlTopics.DataSource = sitemapTopics; dlTopics.DataBind(); } else { dlTopics.Visible = false; } //categories if (SettingManager.GetSettingValueBoolean("Sitemap.IncludeCategories", true)) { //root categories only here var categories = CategoryManager.GetAllCategoriesByParentCategoryId(0); if (categories.Count > 0) { dlCategories.DataSource = categories; dlCategories.DataBind(); } else { dlCategories.Visible = false; } } else { dlCategories.Visible = false; } //manufacturers if (SettingManager.GetSettingValueBoolean("Sitemap.IncludeManufacturers", true)) { var manufacturers = ManufacturerManager.GetAllManufacturers(); if (manufacturers.Count > 0) { dlManufacturers.DataSource = ManufacturerManager.GetAllManufacturers(); dlManufacturers.DataBind(); } else { dlManufacturers.Visible = false; } } else { dlManufacturers.Visible = false; } //products if (SettingManager.GetSettingValueBoolean("Sitemap.IncludeProducts", true)) { var products = ProductManager.GetAllProducts(); if (products.Count > 0) { dlProducts.DataSource = products; dlProducts.DataBind(); } else { dlProducts.Visible = false; } } else { dlProducts.Visible = false; } }