I am developing an addon for EE. i could not find a way to make a variable with multi value behavior. like: i would like to write in the template: {location:lat} {location:lng} this can be (Pair Variables) but it is always about loops.

what is the proper and the write Array syntax to parse to get what i want in the template.

thank you in advance

1 Answer 1


The only add-ons which have an official method of using variable modifiers are fieldtypes, where your fieldtype class' replace_tag function controls {my_field}, replace_lat controls {myfield:lat}, etc.

If you want to use the modifier sytax in a plugin or module, you'd simply name your variables location:lat and location:lng in the array you pass to ee()->TMPL->parse_variables().

The standard way of accessing nested variables like this, given a variables array that looks like:

        'location' => array(
            'lat' => 'foo',
            'lng' => 'bar'

... would be:

  • Thanks allot, Derek when I do the same thing I got the result as Array. it reads it as an array. it works for me as : $json['location'] = array( array('lat'=>$json['location']['lat'],'lng'=>$json['location']['lng']) );
    – Akwad Net
    Apr 14, 2015 at 13:28

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.