Kooboo cms-@Html. fronthtml (). HTMLTitle () detailed

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.