Hi,
recently i changed how a REST API sent the info from xml to JSON, that mean that now the arrays was converted into objects after the json_decode(). don’t was too much problem till i see that my smarty templates don’t worked anymore
the change of each file don’t was an option and the convert from objects to arrays is wasting resources in nothing, so i made a hack in the smarty main class
basically in the file Smarty_Compiler.php at line numero 1203 i added this if():
if(is_object($from)){
$output .= “\$_from = $from;”;
$output .= “foreach(\$_from as $key_part=>$item){“;
}else{
and in the else, you wrap all the other code to parse arrays
now the foreach will parse objects and arrays
i hope it helps.
Regards,
Shadow.





