Exemple #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            writer.WriteLine(string.Empty);
            string controller = _ViewContext.RouteData.Values["controller"].ToString();
            string action     = _ViewContext.RouteData.Values["action"].ToString();

            HeaderBaseClass _HeaderBaseClass = TitltMap.GetNowHeaderBaseClass(controller, action);//当前对象
            ArrayList       _Title           = new ArrayList();

            if (_HeaderBaseClass != null)
            {
                List <HeaderBaseClass> ParentsAndMeList = _HeaderBaseClass.ParentsAndMeList(TitltMap.ReadTitleMapXMLToHeaderBaseClassList());//父级和当前对象list
                ParentsAndMeList = DealHeaderBaseClassList(ParentsAndMeList, _ViewContext);
                _Title           = GetTitle(ParentsAndMeList);
            }
            else
            {
                if (HttpContext.Current.Items[Key] != null)
                {
                    _Title.InsertRange(0, (ArrayList)HttpContext.Current.Items[Key]);
                }
            }
            Model.SiteInfo m_site       = WebCacheHelper.GetSiteInfo();
            ArrayList      _KeyWord     = (ArrayList)_Title.Clone();
            ArrayList      _Description = (ArrayList)_Title.Clone();

            if (string.Join(BrowserTitleSeparator, (string[])_Title.ToArray(typeof(string))).IndexOf(m_site.WebTitle) < 0)
            {
                _Title.Add(m_site.WebTitle);
            }
            //_Title.Add(Common.Config.ConfigInfo<Common.Config.SiteInfo>.Instance().HomeUrl);
            writer.WriteLine("<title>{0}</title>", string.Join(BrowserTitleSeparator, (string[])_Title.ToArray(typeof(string))));

            if (HttpContext.Current.Items[Key2] != null)
            {
                _KeyWord.InsertRange(0, (ArrayList)HttpContext.Current.Items[Key2]);
            }
            _KeyWord.Add(m_site.WebKeyword);
            writer.WriteLine("<meta name=\"keywords\" content=\"{0}\" />", string.Join(BrowserTitleSeparator, (string[])_KeyWord.ToArray(typeof(string))));

            if (HttpContext.Current.Items[Key3] != null)
            {
                _Description.InsertRange(0, (ArrayList)HttpContext.Current.Items[Key3]);
            }
            writer.WriteLine("<meta name=\"description\" content=\"{0}\" />", string.Join(BrowserTitleSeparator, (string[])_Description.ToArray(typeof(string))));

            writer.WriteLine("<meta name=\"copyright\" content=\"{0}\" />", m_site.WebCopyright);

            writer.WriteLine("<meta name=\"author\" content=\"{0}\" />", "成都雷驰科技有限公司");

            base.Render(writer);
        }
Exemple #2
0
        protected override void Render(HtmlTextWriter writer)
        {
            _nowtitle = _ViewContext.ViewData["___Now_SiteMap_Title"] == null ? "" : _ViewContext.ViewData["___Now_SiteMap_Title"].ToString();
            UrlHelper Url = new UrlHelper(_ViewContext.RequestContext);

            writer.WriteLine(string.Empty);
            string controller = _ViewContext.RouteData.Values["controller"].ToString();
            string action     = _ViewContext.RouteData.Values["action"].ToString();

            HeaderBaseClass _HeaderBaseClass = TitltMap.GetNowHeaderBaseClass(controller, action);//当前对象

            if (_HeaderBaseClass == null)
            {
                if (_HeaderBaseClass == null)
                {
                    base.Render(writer); return;
                }
            }
            List <HeaderBaseClass> ParentsAndMeList = _HeaderBaseClass.ParentsAndMeList(TitltMap.ReadTitleMapXMLToHeaderBaseClassList());//父级和当前对象list

            ParentsAndMeList = HeaderHelper.DealHeaderBaseClassList(ParentsAndMeList, _ViewContext);

            string    Str    = "<a " + (_isblank ? " target=\"_blank\" " : "") + " href=\"{0}\">{1}</a>";
            ArrayList output = new ArrayList();

            for (int i = 0; i < ParentsAndMeList.Count; i++)
            {
                HeaderBaseClass __HeaderBaseClass = ParentsAndMeList[i];
                if (i == ParentsAndMeList.Count - 1)
                {
                    output.Add(string.IsNullOrEmpty(_nowtitle) ? __HeaderBaseClass.title : _nowtitle);
                }
                else
                {
                    output.Add(string.Format(Str, string.IsNullOrEmpty(__HeaderBaseClass.url) ? Url.Action(__HeaderBaseClass.a, __HeaderBaseClass.c) : __HeaderBaseClass.url, __HeaderBaseClass.title));
                }
            }
            writer.Write(string.Join(_sign, (string[])output.ToArray(typeof(string))));
            base.Render(writer);
        }