I want to create an XML file through smarty template. For this, i am passing an array to the template file. This is the code i am using to generate array and to pass.
$correct_answers = explode(",", $answer['answer']);
$smarty->assign('answers', $correct_answers);
The array is generated successfully and i checked it by using print_r(); But my problem is, it shows empty in the tpl file. If i check the count, it shows 0. I cannot get the array values. This is the template file code.
{assign var = "inc" value="0"}
{section name=answer loop=$answers}
<simpleChoice identifier="{$answers[answer]}">{$answers[answer]}</simpleChoice>
{assign var = "inc" value=$inc+1}
{/section}
I don't know where i went wrong.
Array Structure is,
Array
(
[0] => Alonso
[1] => Jenson Button
[2] => Rubens Barrichello
)