map not showing when using category menu

By rez - March 30, 2011 - edited: March 30, 2011

When adding the getCategories code for a category menu to the top of my page, the map from the geocoder plug-in disappears and shows my "no map available" message. Removing the list at the top for the categories brings the map back (but of course breaks my navigation).

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/myfolder/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }


// get records

list($nav_menuRecords, $nav_menuMetaData) = getCategories(array(
'tableName' => 'nav_menu',
'categoryFormat' => 'showall', // showall, onelevel, twolevel
));


list($addressRecords, $myMetaData) = getRecords(array(
'tableName' => 'locations',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$record = @$addressRecords[0]; // get first record

// show error message if no matching record is found
if (!$record) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
list($stateRecords, $stateMetaData) = getRecords(array(
'tableName' => 'state',
));
?>



I'm also getting other errors with previously working code:

Notice: Undefined index: address in /home/myfolder/public_html/contact.php on line 120
Notice: Undefined index: city in /home/myfolder/public_html/contact.php on line 121 , Notice: Undefined index: state:label in /home/myfolder/public_html/contact.php on line 121 , Notice: Undefined index: zipcode in /home/myfolder/public_html/contact.php on line 121

Re: [rez] map not showing when using category menu

By robin - March 30, 2011

Hey Rez,

Perhaps your category menu is resetting the $record variable? Otherwise could you post or send your full code to support@interactivetools.com so we can take a closer look.

Thanks,
Robin
Robin
Programmer
interactivetools.com