XF 2.0 xen:raw for XF 2.0

Brettflan

Active member
I'm working on an addon which needs to insert raw HTML into a template, which is output by a custom function I've added. I have made a template modification to insert it using the format "{$user.getCustomData()}" (the function is added using a Class extension), but the function output is being automatically HTML-sanitized so that "<" is encoded to "&lt;", and so forth. I need to have it not sanitize this output.

After looking into it a bit, I found references to using "{xen:raw $variable}" to keep the text from being sanitized, but this seems to be for XenForo 1 and not supported in XF 2.0. Is there some other equivalent method to keep variable data from being sanitized within a template in XF 2.0?
 
Last edited:
Awesome, that did the trick. Thanks!

Yeah, this particular data has no user input, and there's unfortunately no good way around this particular HTML being formatted through a function rather than directly in the templates. Otherwise I'd confine any HTML formatting strictly to the template system.
 
What is correct syntax to xF1 code:
Code:
{xen:raw '$banners.{xen:calc '({$serverTime} % 5) + 1'}'}
?
 
I can't seem to find a method to variably apply variable names, if that makes sense. Thus, I'd suggest you hand over to your viewParams an already calculated serverTime, or even better, the full link. This way, you could use {$yourFullLink|raw}
 
Back
Top Bottom