Hi,
I have tried using the code below in a node template file but keep getting this message:
Parse error: syntax error, unexpected ':'
if ($_SESSION['smart_ip']['location']['country_code'] == 'AT' || ($_SESSION['smart_ip']['location']['country_code'] == 'Be' || ($_SESSION['smart_ip']['location']['country_code'] == 'BG' || ($_SESSION['smart_ip']['location']['country_code'] == 'CY' || ($_SESSION['smart_ip']['location']['country_code'] == 'CZ' || ($_SESSION['smart_ip']['location']['country_code'] == 'SE' ||
($_SESSION['smart_ip']['location']['country_code'] == 'FR'): €1.99
elseif ($_SESSION['smart_ip']['location']['country_code'] == 'UK'):
£1.99
else:
$1.99
endif;
any ideas?
Thanks again for your help Roland
Comments
Comment #1
dman commentedYes.
Your code syntax is crap.
Each
(must be matched with one closing).The condition you posted up there is totally unbalanced.
Either have just one pair of brackets there, with all the conditions inside it (it'll work, but may look ambiguous), or nest your brackets so each == condition is grouped tidily.
or
Comment #2
arpeggio commentedYou have missing closing parenthesis. Please follow dman's advice. Thanks.
Comment #3
nyleve101 commentedThanks for explanation.
Comment #6
rdentry commentedI'm doing basically the same thing, hiding fields based on "country code". I'm guessing if I want to do this with views, I would have to format the teaser in the theme using this code and just print out the teaser in a view? Not sure if this kind of support is available in the fields part of views (I know you can't add this in the 'rewrite output' area). Just wondering if there are any alternatives using this sort of filtering with views?
Comment #7
arpeggio commentedHi rdentry, sorry for the delay. The Smart IP for D6 now do have Views filter. Thanks.