XF 1.5 Conditional / variable to show text not in specific threads

Arno Nühm

Active member
I would like to show some text everywhere but not in some specific threads.

To have it work e.g. in PAGE_CONTAINER template, I use this code:

Code:
<xen:if is="!in_array({$threadId}, array(1,2,3,4))">
    TEXT
</xen:if>

and this code in thread_view template:

Code:
    <xen:container var="$threadId">{$thread.thread_id}</xen:container>

Works perfect.

BUT I would like to use it in many different templates. So I would need to update the list of thread IDs in the array in many places if there is a change.

Is it possible to only have ONE place with all the thread IDs and still be able to use them as conditional?

Could I use some kind of "$variable = 1,2,3,4" somewhere and use something like <xen:if is="!in_array({$threadId}, array($variable))"> in all the templates?

Sorry for my bad English. Hard to describe what I would like to have.
 
Last edited:
Maybe I am near to find a solution.

If I set some variables like ...

Code:
<xen:set var="$myvar.1">1</xen:set>
<xen:set var="$myvar.2">2</xen:set>
<xen:set var="$myvar.3">3</xen:set>

... I am able to use it in a conditional like ...

Code:
<xen:if is"!in_array({$threadId}, {$myvar})">TEXT</xen:if>

Works.

BUT how can I set the $myvar global to work in ALL templates?
 
Maybe I am near to find a solution.

If I set some variables like ...

Code:
<xen:set var="$myvar.1">1</xen:set>
<xen:set var="$myvar.2">2</xen:set>
<xen:set var="$myvar.3">3</xen:set>

... I am able to use it in a conditional like ...

Code:
<xen:if is"!in_array({$threadId}, {$myvar})">TEXT</xen:if>

Works.

BUT how can I set the $myvar global to work in ALL templates?
ever figure this out?
 
Top Bottom