$(resource_name)
$(resource_images)
$(resource_description)
$(resource_properties) TMPL; //////////////////////////////////////////// // code to fetch data from planyo $page = 0; while (true) { $response_raw = file_get_contents("https://www.planyo.com/rest/?api_key=".API_KEY."&method=get_all_resources&detail_level=15&language=".LANGUAGE); $response_json = json_decode($response_raw, true); foreach ($response_json['data']['resources'] as $resource_id=>$resource) { $resource_images = ""; $photo_number = 0; foreach ($resource['photos'] as $photo_id=>$photo_url) { $resource_images .= ""; if (++$photo_number == PHOTO_COUNT) break; } $resource_properties = "
"; foreach ($resource['properties'] as $property_name=>$property_value) { if ($property_name != 'description' && $property_value && $property_value != 'none') { $resource_properties .= "
".$property_name.": ".$property_value."
"; } } $resource_properties .= "
"; $code = $resource_template; $code = str_replace ("$(resource_id)", $resource_id, $code); $code = str_replace ("$(resource_name)", $resource['name'], $code); $code = str_replace ("$(resource_images)", $resource_images, $code); $code = str_replace ("$(resource_description)", $resource['properties']['description'], $code); $code = str_replace ("$(resource_properties)", $resource_properties, $code); echo $code; } $max_page = (int) $response_json['data']['max_page']; if (!$max_page || ++$page > $max_page) break; } ?>