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} 
  • a solution seems to be using an embed instead. – Peter Eastwood May 15 '13 at 15:51
6

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

$config['protect_javascript'] = 'n';
| improve this answer | |
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.

| improve this answer | |
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.

| improve this answer | |
  • "$config['debug']= 0" and "$config['remove_unparsed_vars'] = 'y'"? – Robson Sobral May 16 '13 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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