Hey Ozazio,
This is possible, you just need to adapt sample_map_multi.php (which is included with the plugin) to load the records from the different sections. Below is some sample code that shows how you could load data from sections called hotel and bars, but you can extend this to work with as many sections as you'd like.
Step 1) Load all the records that are required on line 13 of the plugin. Replace:
// get records
list($myRecords, $myMetaData) = getRecords(array(
'tableName' => $GLOBALS['GEOCODER_SAMPLE_TABLENAME'],
));
with the sections, you need to get the data from:
// get records
list($bars, $myMetaData) = getRecords(array(
'tableName' => 'bars',
));
list($hotels, $myMetaData) = getRecords(array(
'tableName' => 'hotels',
));
Step 2) Update the JS at the top of the page to add each marker. Replace:
<?php
foreach ($myRecords as $record) {
if (!$record['latitude'] || !$record['longitude']) { continue; }
$jsFunctionArgs = "{$record['latitude']}, {$record['longitude']}, {$record['num']}, '" .jsEncode($record['_link']). "'";
print " _geocoder_addMarker($jsFunctionArgs);\n";
}
?>
With the same code block, but make it loads the records you retrieved previously:
foreach ($bars as $record) {
if (!$record['latitude'] || !$record['longitude']) { continue; }
$jsFunctionArgs = "{$record['latitude']}, {$record['longitude']}, {$record['num']}, '" .jsEncode($record['_link']). "'";
print " _geocoder_addMarker($jsFunctionArgs);\n";
}
foreach ($hotels as $record) {
if (!$record['latitude'] || !$record['longitude']) { continue; }
$jsFunctionArgs = "{$record['latitude']}, {$record['longitude']}, {$record['num']}, '" .jsEncode($record['_link']). "'";
print " _geocoder_addMarker($jsFunctionArgs);\n";
}
Step 3) Duplicate the marker code at the bottom of the page. Update:
<?php foreach ($myRecords as $record): ?>
<?php // marker_infowindow_### is the content displayed in the info-window on click ?>
<div id="marker_infowindow_<?php echo $record['num']; ?>">
<h3><?php echo htmlencode( @$record['address']); ?></h3>
Add any extra content you like here...<br/>
<a href="<?php echo $record['_link']; ?>">details</a>
</div>
<?php endforeach ?>
So that it is called for each set of records (as we've done above). So we'd duplicate this code twice then replace $myRecords with $blog and $hotels in each code block.
Finally, you'll need to update line 81 from this:
<?php $hasAddresses = array_filter(array_pluck($myRecords, 'latitude')); ?>
To this:
<?php $hasAddresses = true; ?>
Cheers,
Greg
Greg Thomas
PHP Programmer - interactivetools.com