xen:raw with xen:helper wordtrim?

Jaxel

Well-known member
I want to use wordtrim on a raw text field. However, the built-in wordtrim helper uses htmlspecialchars, so it inherently cant be used with raw text. Does XF have a helper for this?
 
In a template? Yes..
Code:
{xen:helper wordtrim, Your_String, Trim_Length}

In PHP...
Code:
XenForo_Helper_String::wholeWordTrim(Your_String, Trim_Length)

I don't see anything in the php code about htmlspecialchars. I must be blind. :)
 
I don't see anything in the php code about htmlspecialchars. I must be blind. :)

XenForo_Template_Helper_Core
Code:
    public static function helperWordTrim($string, $trimLength)
    {
        return htmlspecialchars(XenForo_Helper_String::wholeWordTrim($string, $trimLength));
    }
 
OK, I'm blind. :D

Have you tried setting up your own helper that calls XenForo_Helper_String::wholeWordTrim($string, $trimLength) without htmlspecialchars?

Code:
public static function helperYourHelper($string, $trimLength)
{
          return XenForo_Helper_String::wholeWordTrim($string, $trimLength);
}
 
Last edited:
Back
Top Bottom