hi I have a snippet that returns a json array that I put back in a php array later. I do this to be able to call the snippet in another snippet and get the array it produces
here is the inner snippet:
$myCountries = $xpdo->getCollection('Countries');
foreach ($myCountries as $country) {
$countries[$country->get('idCountries')]=$country->get('Country_'.$lang);
}
//print_r($countries); // used to check if $countries contains all the wanted strings
return $modx->toJson($countries);
part of the outer snippet
$mycountries=$modx->fromJson($modx->runSnippet('getcountries',array('lang' => $lang)));
//print_r ($mycountries);
here is the problem: the print_r of the $countries in the inner snippet gives:
Array ( [AT] => Oostenrijk [BE] => Belgi� [DE] => Duitsland [DK] => Denemarken [ES] => Spanje [FR] => Frankrijk [GB] => Verenigd Koninkrijk [IE] => Ierland [IT] => Itali� [LU] => Luxemburg [NL] => Nederland [PT] => Portugal )
while the outer snippet print_r of $mycountries gives:
Array ( [AT] => Oostenrijk
[BE] => [DE] => Duitsland [DK] => Denemarken [ES] => Spanje [FR] => Frankrijk [GB] => Verenigd Koninkrijk [IE] => Ierland
[IT] => [LU] => Luxemburg [NL] => Nederland [PT] => Portugal )
notice the part in bold:
België and Italië have dissapeared in the Json conversion.
if I printout the Json conversion of $countries in the inner snippet I get:
{"AT":"Oostenrijk","BE":null,"DE":"Duitsland","DK":"Denemarken","ES":"Spanje","FR":"Frankrijk","GB":"Verenigd Koninkrijk","IE":"Ierland","IT":null,"LU":"Luxemburg","NL":"Nederland","PT":"Portugal"}
with a "null" for BE and IT
can anyone tell me what I am doing wrong?