Geocoder plugin - category limit - page disappears
2 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: August 10, 2012 (RSS)
By Mikey - August 9, 2012 - edited: August 9, 2012
I've got a category menu set up to post listings of business - categorized by the service offerings they provide.
The top tier and second tier categories flow similar to:
Accounting (no address and no zipcode = so no longitude / latitude generated)
• Company A, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company B, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company C, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company D, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
Banks (no address and no zipcode = so no longitude / latitude generated)
• Company E, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company F, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company G, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company H, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
Communication (no address and no zipcode = so no longitude / latitude generated)
• Company I, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company J, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company K, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company L, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
... and so for a total of 143 business listings, sorted into top tier categories based on the business services offered.
The problem I'm having is that when I reach 70 records my entire webpage goes blank except for a single number (1) displayed on the screen. If I limit the records output to 69 my page displays properly and my map works, change it to anything above 69 and it vanishes again, If I remove the 'limit' => '69', the entire page goes blank again except for a single number (1) displayed on the screen.
Anyone experienced similar issues using Geocoder with Category Menus and have an idea how to resolve this?
// get records
list($myRecords, $myMetaData) = getRecords(array(
'tableName' => 'business_listings',
'limit' => '69',
));
The top tier and second tier categories flow similar to:
Accounting (no address and no zipcode = so no longitude / latitude generated)
• Company A, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company B, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company C, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company D, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
Banks (no address and no zipcode = so no longitude / latitude generated)
• Company E, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company F, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company G, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company H, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
Communication (no address and no zipcode = so no longitude / latitude generated)
• Company I, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company J, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company K, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
• Company L, Address, City, State, Zip, Phone, Website (zipcode = longitude / latitude)
... and so for a total of 143 business listings, sorted into top tier categories based on the business services offered.
The problem I'm having is that when I reach 70 records my entire webpage goes blank except for a single number (1) displayed on the screen. If I limit the records output to 69 my page displays properly and my map works, change it to anything above 69 and it vanishes again, If I remove the 'limit' => '69', the entire page goes blank again except for a single number (1) displayed on the screen.
Anyone experienced similar issues using Geocoder with Category Menus and have an idea how to resolve this?
// get records
list($myRecords, $myMetaData) = getRecords(array(
'tableName' => 'business_listings',
'limit' => '69',
));
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
// load viewer library
$libraryPath = 'cmsbuilder/lib/viewer_functions.php';
$dirsToCheck = array('/home/content/11/2233344/html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!@$GLOBALS['GEOCODER_PLUGIN']) { die("You must activate the Geocoder plugin before you can access this page."); }
// get records
list($myRecords, $myMetaData) = getRecords(array(
'tableName' => 'business_listings',
));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Show map with multiple addresses (using Google Maps API V3)</title>
<style type="text/css">
body, td { font-family: arial; font-size: 14px; }
</style>
<!-- STEP1: Map with multiple addresses: Put this in the <head> of your page, rename $myRecords if needed -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var mapCanvasId = 'map_canvas';
var mapOptions = { mapTypeId: google.maps.MapTypeId.ROADMAP };
var map = new google.maps.Map(document.getElementById(mapCanvasId), mapOptions);
var bounds = new google.maps.LatLngBounds();
var infowindow = new google.maps.InfoWindow();
<?php
foreach ($myRecords as $record) {
if (!$record['latitude'] || !$record['longitude']) { continue; }
$jsFunctionArgs = "{$record['latitude']}, {$record['longitude']}, {$record['num']}, '" .escapeJs($record['_link']). "'";
print " _geocoder_addMarker($jsFunctionArgs);\n";
}
?>
//
function _geocoder_addMarker(latitude, longitude, recordNum, detailLink) {
var latLng = new google.maps.LatLng(latitude, longitude);
var infowindowEl = document.getElementById('marker_infowindow_' + recordNum);
var marker = new google.maps.Marker({ map: map, position: latLng });
google.maps.event.addListener(marker, 'click', function() {
if (infowindowEl) {
infowindow.setContent(infowindowEl.innerHTML);
infowindow.open(map, marker);
}
else {
window.location = detailLink;
}
});
bounds.extend(latLng);
}
//
map.fitBounds(bounds);
}
</script>
<!-- STEP1: Map with multiple addresses -->
</head>
<!-- STEP2: Map with multiple addresses: add this to body tag: onload="initialize() -->
<body onload="initialize()">
<!-- STEP2: Map with multiple addresses -->
<h1>Show map with multiple addresses (using Google Maps API V3)</h1>
<!-- STEP3: Map with multiple addresses: Put this where you want your map displayed, rename $myRecords if needed -->
<?php $hasAddresses = array_filter(array_pluck($myRecords, 'latitude')); ?>
<?php if ($hasAddresses): ?>
<div id="map_canvas" style="width: 299px; height: 299px; float: left; margin: 0px 15px;"></div>
<?php endif ?>
<?php if (!$hasAddresses): ?>
<div style="width: 299px; height: 299px; float: left; margin: 0px 15px; border: 1px solid #000;">
<div style="text-align: center; padding-top: 135px">
No map available!
</div>
</div>
<?php endif ?>
<!-- STEP3: /Map with multiple addresses -->
<p>TIP: Click on markers for more details.</p>
<!-- STEP4: Map with multiple addresses: Set the popup window content, rename $myrecords if needed -->
<div id="marker_details" style="display: none;">
<?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 htmlspecialchars( @$record['address']); ?></h3>
Add any extra content you like here...<br/>
<a href="<?php echo $record['_link']; ?>">details</a>
</div>
<?php endforeach ?>
</div>
<!-- STEP4: Map with multiple addresses -->
</body>
</html>
Re: [zick] Geocoder plugin - category limit - page disappears
By Jason - August 10, 2012
Hi Zick,
I haven't seen that issue before. I can't see any problems in your code. By the time you page is loaded, all of your records would have already been geocoded, so there shouldn't be any issue there either.
If I could get you to send in a [url http://www.interactivetools.com]2nd Level Support Request[/url], I can take a closer look at the page to see if we can pin point the issue.
Thanks,
I haven't seen that issue before. I can't see any problems in your code. By the time you page is loaded, all of your records would have already been geocoded, so there shouldn't be any issue there either.
If I could get you to send in a [url http://www.interactivetools.com]2nd Level Support Request[/url], I can take a closer look at the page to see if we can pin point the issue.
Thanks,
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/