XF 1.1 Too Many Conditions In "If" Condition. Help Me Optimize It.

TheBigK

Well-known member
I'm using following code to display adsense on specific pages -

Code:
<xen:if is="{$contentTemplate} !== 'forum_list' AND {$contentTemplate} !== 'register_form' AND {$contentTemplate} !== 'EWRatendo_Monthly'  AND {$contentTemplate} !== 'member_list' AND {$contentTemplate} !== 'online_list' AND {$contentTemplate} !== 'news_feed_page_global'">

It does the work, but is there a better or graceful way of passing too many conditions to "if"?
 
Why not do the logic in PHP and then pass a boolean variable such as $isMyTemplate, then all you have to do is:
<xen:if is="{$isMyTemplate}">
 
Why not do the logic in PHP and then pass a boolean variable such as $isMyTemplate, then all you have to do is:
<xen:if is="{$isMyTemplate}">
Well, I'm not at all familiar with programming. Could you tell me how can I group all these conditions?

What I'm trying to achieve is -

<xen:if (conditions) >

-> Display Adsense Code

</if>
 
You will need an ad-on in order to get at the hooks of the different ad positions.
Otherwise, instead of excluding too many names (!=) just check for the ones you want (==) which might be a shorter if statement.
 
Oh well, my question is actually very simple. Can this 'if' thing be re-written in a better way or the one I've written in the first post is the only way to write that 'if' condition?
 
Top Bottom