Ejemplo n.º 1
0
        public ActionResult RenderSubNavForChannelPage(int catId, string customTitle = "", WebLanguage language = WebLanguage.zh_cn)
        {
            /*
             * <span class="fgray">您所在的位置:</span><a href="#">首页</a> &gt; <a href="http://www.mtd.com.cn/about.htm">
             *  关于机科</a> &gt; 公司简介
             */
            StringBuilder sbNav = new StringBuilder(string.Format("<span class=\"fgray\">{2}:</span><a href=\"/{1}\">{0}</a>",
                                                                  LanguageResourceHelper.GetString("channel-sub-nav-home-text", language),
                                                                  (language == WebLanguage.zh_cn ? string.Empty : language.ToString()),
                                                                  LanguageResourceHelper.GetString("current-text", language))
                                                    );

            if (catId > 0)
            {
                //可以显示未启用的分类,但是不能显示已删除的分类
                var upList = CategoryService.ListUpById(catId, language).Where(p => p.IsDeleted == false);

                foreach (var item in upList)
                {
                    sbNav.AppendFormat("&nbsp;&nbsp;>&nbsp;&nbsp;<a href=\"{1}\" title=\"{0}\">{0}</a>", item.Name, item.Url);
                }
            }
            if (!string.IsNullOrEmpty(customTitle))
            {
                sbNav.AppendFormat("&nbsp;&nbsp;>&nbsp;&nbsp;{0}", customTitle);
            }

            return(Content(sbNav.ToString()));
        }
Ejemplo n.º 2
0
        public ActionResult RenderSubNavForChannelPage(int siteId, int catId, string customTitle, WebLanguage language = WebLanguage.zh_cn)
        {
            StringBuilder sbNav = new StringBuilder(string.Format("<a href=\"/{1}\">{0}</a>",
                                                                  LanguageResourceHelper.GetString("channel-sub-nav-home-text", language),
                                                                  (language == WebLanguage.zh_cn ? string.Empty : language.ToString())
                                                                  ));

            if (catId > 0)
            {
                var upList = CategoryService.ListUpById(siteId, catId);

                foreach (var item in upList)
                {
                    sbNav.AppendFormat("&nbsp;&nbsp;>&nbsp;&nbsp;{0}", CategoryLinkUrlHelper.BuildLink(item, language));
                }
            }
            if (!string.IsNullOrEmpty(customTitle))
            {
                sbNav.AppendFormat("&nbsp;&nbsp;>&nbsp;&nbsp;{0}", customTitle);
            }

            return(Content(sbNav.ToString()));
        }