Hi I'm stuck with this output, please suggest what's wrong:
$responsexml = @simplexml_load_string($result, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
foreach ($responsexml as $hotelresponse)
{
$hotelname = ($hotelresponse->HotelInfo->Name);
$hoteldestination = ($hotelresponse->HotelInfo->Destination->Name);
$hotelcategory = ($hotelresponse->HotelInfo->Category);
$hotelimage = ($hotelresponse->HotelInfo->ImageList->Image[0]->Url);
$returnedoutput .= $modx->getChunk('_testxmlchunk',array(
'hotel' => $hotelname,
'destination' => $hoteldestination,
'category' => $hotelcategory,
'image' => $hotelimage,
));
}
return $returnedoutput;
_testxmlchunk chunk template:
<li>this is <b>[[+hotel]]</b> is in <b>[[+destination]]</b> category <b>[[+category]]</b> pic <img src="[[+image]]"/></li>
It doesn't output anything
but when I do this.. it works
$responsexml = @simplexml_load_string($result, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
foreach ($responsexml as $hotelresponse)
{
$hotelname = ($hotelresponse->HotelInfo->Name);
$hoteldestination = ($hotelresponse->HotelInfo->Destination->Name);
$hotelcategory = ($hotelresponse->HotelInfo->Category);
$hotelimage = ($hotelresponse->HotelInfo->ImageList->Image[0]->Url);
$returnedoutput .= $hotelname.' '.$hotelimage.' '. $hoteldestination.' '.$hotelcategory.';
}
return $returnedoutput;
any suggestion... Did I miss something? I want to template my snippet.