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

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

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

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


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

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

to work properly.

  • "$config['debug']= 0" and "$config['remove_unparsed_vars'] = 'y'"?
    – 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.