This map loads every .gpx file in a given folder, using the following PHP code:
gv_options.onload_function = 'GV_Autozoom()';
gv_options.dynamic_data = [];
<?php
$gpx_directory = 'tracks';
$file_list = scandir($gpx_directory);
foreach ($file_list as $file) {
if (preg_match('/\.gpx$/',$file)) {
$gpx_url = $gpx_directory.'/'.$file;
?>
gv_options.dynamic_data.push({
url:'<?=$gpx_url?>', autozoom:false
});
<?php
}
}
?>
[Return to the PHP maps tutorial]