XF 1.4 Inline conditional

RichardKYA

Well-known member
Hello all,

I'm trying to get this to work...

Code:
{xen:if '{$contentTemplate} != "forum_list" || {$contentTemplate} != "pagenode_container"', 'filter'}

...what am I doing wrong?

Thank you kindly :)
 
Basically, it's just ignoring these conditions and applying the class anyway. The conditions work fine if I separate them and do them individually, but using the || doesn't seem to work :confused:
 
Actually, the syntax does appear to be correct. I didn't really focus on the logic behind the statement.

|| is the same as saying OR

!= is the same as saying NOT EQUAL

In that case, the logic says if the template is anything at all, apply the class, e.g:

If the template IS forum_list then it is NOT EQUAL to pagenode_container therefore it will add the filter class.
If the template is (as an example) thread_view then it is not equal to pagenode_container and it is not equal to forum_list therefore it will add the filter class.

What exactly are you trying to do, I think you need to use slightly different logic to achieve it.
 
Of course, that makes perfect sense now that I think about it.

I want the class to be added to all templates apart from the forum_list and page_container.

How about something like...

Code:
{xen:if '{$contentTemplate} == "forum_list" || {$contentTemplate} == "pagenode_container"', '', 'filter'}
 
Hold on, wouldn't && solve my problems...

Code:
{xen:if '{$contentTemplate} != "forum_list" && {$contentTemplate} != "pagenode_container"', 'filter'}

Lmao, stupid brain
 
Back
Top Bottom