First we find this class.
This class has the following methods:
#regionTitle & Meta[Obsolete ("Use htmltitle")] Publicihtmlstring Title () {returnHTMLTitle (); } /// <summary> ///htmls the title. /// </summary> /// <returns></returns> Public Virtualihtmlstring HTMLTitle () {returnHTMLTitle (NULL); } /// <summary> ///htmls the title. /// </summary> /// <param name= "Defaulttitle" >The HTML title.</param> /// <returns></returns> Public VirtualIhtmlstring HTMLTitle (stringdefaulttitle) { vartitle =string. IsNullOrEmpty ( This. PageContext.HtmlMeta.HtmlTitle)? Defaulttitle: This. PageContext.HtmlMeta.HtmlTitle; if(!string. IsNullOrEmpty (title)) {return NewHtmlstring (string. Format ("<title>{0}</title>", Kooboo.StringExtensions.StripAllTags (title))); } return NewHtmlstring (""); }
View Code
In fact, I think it is necessary for everyone to understand the ihtmlstring of this interface.
This interface is not derived from the CMS, but is defined within the system.
Using System;namespace system.web{ //Abstract: // indicates that HTML-encoded strings should not be encoded again. Public Interface Ihtmlstring { //Summary: // Returns an HTML-encoded string. //// return Result: // HTML-encoded string. string tohtmlstring ();} }
A detailed introduction to this interface I also searched the Internet, which is on MSDN. I wonder who has more detailed information?
Here's one of the most important ways to do this:
Public VirtualIhtmlstring HTMLTitle (stringdefaulttitle) { vartitle =string. IsNullOrEmpty ( This. PageContext.HtmlMeta.HtmlTitle)? Defaulttitle: This. PageContext.HtmlMeta.HtmlTitle; if(!string. IsNullOrEmpty (title)) {return NewHtmlstring (string. Format ("<title>{0}</title>", Kooboo.StringExtensions.StripAllTags (title))); } return NewHtmlstring (""); }
The above code means that if the current context htmlmeta.htmltitle is empty, then the caption that is brought in is taken. However, if both Defaulttitle and Htmlmeta.htmltitle are empty, then an empty string is returned. otherwise execute <title>{0}</title>.
Kooboo cms-@Html. fronthtml (). HTMLTitle () detailed