3

Why are my if conditions not working when they are inside a javascript but they work in plain html? the {if longitude} outputs {if""} when viewed in the browser.

{exp:user:users sort="asc" limit="100" group_id="5"}
{if longitude}
         {
            "properties": {                         
                "tags": [],
                "phone": "",
                "classifiers": ['a'],
                "address": "",
                "name": "{billing_name}",
                "province": "{billing_region}",
                "owner": "",
                "postcode": "",
                "city": "{billing_city}",
                "country": "{billing_country}"
            },
            "type": "Place",
            "geometry": {
                "type": "Point",
                "coordinates": [ {longitude},{latitude} ]
            }
        },
{/if}
{/exp:user:users} 
1
  • a solution seems to be using an embed instead. Commented May 15, 2013 at 15:51

3 Answers 3

6

By default EE prevents the advanced conditional parser from processing anything between <script> tags. Try adding this config variable:

$config['protect_javascript'] = 'n';
0

I think the case might be that the conditionals are being rendered by the js and not by EE. It wouldn't surprise me.

0

Strange anomaly, that I don't know if it still exists or not is that for this type of thing to work, I had to make sure that php error reporting was set to "1" for

jQuery(function(){
      options = {serviceUrl:'{site_url}utility/suggest_names'};
      a = $('#query').autocomplete(options);
    });

to work properly.

1
  • "$config['debug']= 0" and "$config['remove_unparsed_vars'] = 'y'"?
    – Sobral
    Commented May 16, 2013 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.