/// <summary> /// 文章分类列表数据 /// </summary> /// <param name="id">文章分类列表的主键值</param> /// <returns>文章分类列表数据模型</returns> public static string NameList(string idList) { List <string> contentList = new List <string>(); if (!string.IsNullOrEmpty(idList)) { idList = idList.Substring(1, idList.Length - 2); } idList = idList.Replace("||", "#"); if (idList.Length > 0) { foreach (string temp in idList.Split('#')) { List <string> nameList = new List <string>(); foreach (string id in temp.Split('|')) { nameList.Add(ArticleClassBLL.Read(Convert.ToInt32(id)).Name); } if (nameList.Count > 0) { contentList.Add(string.Join(" > ", nameList)); } } } return(string.Join(",", contentList)); }
/// <summary> /// 面包屑导航改进版,根据分类自动显示对应链接 /// </summary> /// <param name="idList"></param> /// <returns></returns> public static string ArticleClassNavigationList(string idList) { string content = string.Empty; if (idList != string.Empty) { idList = idList.Substring(1, idList.Length - 2); } idList = idList.Replace("||", "#"); if (idList.Length > 0) { foreach (string temp in idList.Split('#')) { string tempArticleClassName = string.Empty; int linkCount = 1; foreach (string id in temp.Split('|')) { if (tempArticleClassName == string.Empty) { if (linkCount < temp.Split('|').Length) { tempArticleClassName = "<a href=\"" + GetClassUrl(Read(Convert.ToInt32(id))) + "\" >" + Read(Convert.ToInt32(id)).Name + "</a>"; } else { tempArticleClassName = ArticleClassBLL.Read(Convert.ToInt32(id)).Name; } } else { if (linkCount < temp.Split('|').Length) { tempArticleClassName += " > <a href=\"" + GetClassUrl(Read(Convert.ToInt32(id))) + "\" >" + ArticleClassBLL.Read(Convert.ToInt32(id)).Name + "</a>"; } else { tempArticleClassName += " > " + ArticleClassBLL.Read(Convert.ToInt32(id)).Name + ""; } } linkCount++; } if (tempArticleClassName != string.Empty) { if (content == string.Empty) { content = tempArticleClassName; } else { content += "," + tempArticleClassName; } } } } return(content); }