html()

October CMS Documentation Docs

html()

Functions prefixed with html_ perform tasks that are useful when dealing with HTML markup. The helper maps directly to the Html PHP class and its methods. For example:

___TWIG0___

The above is the PHP equivalent of the following:

<?= Html::strip() ?>

Note: Methods in camelCase should be converted to snake_case.

You may also apply the HTML functions as a Twig filter.

___TWIG0___

# html_strip()

Removes HTML from a string.

___TWIG0___

# html_limit()

Limits HTML with specific length with a proper tag handling.

___TWIG0___

To add a suffix when limit is applied, pass it as the third argument. Defaults to ....

___TWIG0___

# html_clean()

Cleans HTML to prevent most XSS attacks.

___TWIG0___

# html_email()

Obfuscates an e-mail address to prevent spam-bots from sniffing it.

___TWIG0___

For example:

<a href="mailto: ___TWIG0___">Email me</a>

<!-- The above will output -->
<a href="mailto: &#109;&#97;&#105;&#108;&#x74;o&#x3a;&#97;&#64;b.&#x63;">Email me</a>