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

XF 1.4 Can you use LIKE conditionals?

Phases

Active member
#1
I'm trying to do something like this:
Code:
<xen:if is="{$forum.title} LIKE 'root'">
or

Code:
<xen:if is="{$forum.title} == '%root%'">
or something similar I've tried a few things. Is there a way to do this? Looking for basically any forum name with the word root in it to be returned true. Appreciate any help!

Edit: Answer posted below:

Code:
<xen:if is="strpos({$forum.title}, 'root') !== false">
Should work.
stripos is the case insensitive version just FYI
 
Last edited:

Brogan

XenForo moderator
Staff member
#2
I have never actually tested that but I don't believe it's possible to do a partial match on a variable in that manner.
 

Phases

Active member
#3
In the words of my wise 'ol man, Dag-gummit.

Hopefully we'll be surprised with someone swooping in to save the day.

Thanks,