menu

Codeigniter Typography Helper


Codeigniter Typography Helper – Codeigniter Typography Helper contains functions it will help us Formatting the text in an appropriate manner likes wrapping with paragraphs, convert break line into dash and ellipses. $this->load->helper(‘typography’); is used to load the helper. Here in this tutorial, we are going to explain how to use Typography helper in CodeIgniter.


Codeigniter Typography Helper Example

Let us first see how to load Typography helper in codeigniter and then use its function-

Load Typography Helper

How To Load Typography Helper in Codeingniter Example:

Functions:-

There are many functions are available in Typography helper. Now we will explain one by one with example.

    • 1. typography-safe string
    • 2. formatted line breaks string
    • 3. decoded entities string

    1. typography-safe string

    Syntax of typography-safe string function is

    Syntax of typography-safe string function is:-

      Parameters:

    • $str (string) : Input string
    • $reduce_linebreaks (bool) : Whether to reduce multiple instances of double newlines to two
    • Returns : HTML-formatted typography-safe string
    • Return type : string

    EXAMPLE

    Here is simple example of typography-safe string.

    typography-safe string in Codeigniter Example:-

    This Helper Convert New Lines to Paragraph

    The output will be like this –

    Codeigniter Typography Helper

    2. formatted line breaks string

    Syntax of formatted line breaks string function is

    Syntax of formatted line breaks string function is:-

      Parameters:

    • $str (string) : Input string
    • Returns : String with HTML-formatted line breaks
    • Return type : string

    EXAMPLE

    Here is simple example of formatted line breaks string.

    formatted line breaks string in Codeigniter Example:-

    This Helper Convert New Lines to Break Lines

    The output will be like this –

    Codeigniter Typography Helper

    3. decoded entities string

    Syntax of decoded entities string function is

    Syntax of decoded entities string function is:-

      Parameters:

    • $str (string) : Input string
    • $charset (string) : Character set
    • Returns : String with decoded HTML entities
    • Return type : string

    EXAMPLE

    Here is simple example of decoded entities string.

    decoded entities string in Codeigniter Example:-

    The output will be like this –

Advertisements