• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Print string with html tags

In my template I need to print a string with some html tags in it.

Let's say I have:

$my_string = "This is my string with a <a href="https://xenforo.com">link</a>"

If I use the simple {$my_string} the html tags won't be parsed and will be displayed as string.

I didn't find any documentation about how to parse this kind of string. Any suggestions?

Chris D

XenForo developer
Staff member
There's no documentation, as such, but it is used in places in the existing templates.

It should be used sparingly. It essentially prevents the value from being escaped which is usually preferable to avoid being open to XSS vulnerabilities.

In terms of seeing what else there is, you could search templates for {xen: to see what else there is. There's some more prevalent than others, such as {xen:phrase and {xen:link.