0

I am very curious and very new to ExpressionEngine. Is it possible to send an array of values to an EE tag? i.e.

{exp:className:functionName parameter="value"}

Can the above parameter be of type array or can these parameters only pass single atomic values to the method?

If not, how would one be able to send arrays to a module function?

1
  • Are you coding your own add-on?
    – Sobral
    Jul 18 '14 at 15:54
1

Parameters are passed into expressionengine tags as strings. I assume you are trying to pass in a php array into your parameter. In that case, you would need to refer to that particular tag's documentation to see how the values need to be passed in (e.g. pipe delimited "value1|value2" or comma delimited "value1,value2"). If you are using php, you can call the php implode function and that will return a string you can pass in.

<?php 
$foo = array('hello', 'world', '!'); 
$bar = implode('|', $foo);
?>
{exp:whatever:tag data="<?=$bar?>"}

If you are not using php, then I believe you are thinking about the way expressionengine works incorrectly. ExpressionEngine does not produce arrays that can be used in your template that way.

If you are developing your own plugin, then you will need to do the opposite. You will need to fetch you parameter and explode it based on whatever delimiter is getting passed in.

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.