XF 1.5 Template Conditional Syntax

Brent W

Well-known member
So I have a basic add-on that sets the Country Code based on Cloudflares GeoIP header.

The Listener is:

Code:
<?php
class BamaStangGuy_CFGeoIP_Listener
{
    public static function template_create(&$templateName, array &$params, XenForo_Template_Abstract $template)
    {
         $params['countryCode'] = $_SERVER["HTTP_CF_IPCOUNTRY"];
    }

}

I am using this template conditional:

HTML:
<xen:if is="{$countryCode} == 'IN' OR {$countryCode} == 'RU' OR {$countryCode} == 'CN'">

Is there a better conditional I can use (shorter using an array)?
 
You should be able to use in_array. Something like:
Code:
<xen:if is="in_array({$countryCode}, array('IN', 'RU', 'CN'))">
 
Top Bottom