Chris,
I am trying to pull off this category menu thing and followed your instructions but just can't get it to work. I have a category menu set up as regions and a multi record called listings. I created the list pulldown with these settings:
Field Label: City/Town
Field Name: city_town
Field Type: list
Field Options
Display As: pulldown
List Options: Get options from database (advanced)
Section Tablename: regions
Use this field for option values: num
Use this field for option labels: name
I keep getting this error:
Fatal error: Call to undefined function getregion() in /home/gselect/public_html/dev/listing.php on line 38
Here is the code in my page:
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "/home/gselect/public_html/cmsAdmin/lib/viewer_functions.php";
list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
beta_lookupRelatedFields(array(
'table' => 'listings',
'recordList' => &$listingsRecords,
'fieldList' => array( 'agent')
));
$listingsRecord = @$listingsRecords[0]; // get first record
// show error message if no matching record is found
if (!$listingsRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
list($agentsRecords, $agentsMetaData) = getRecords(array(
'tableName' => 'agents',
));
?>
<?php
require_once "/home/gselect/public_html/cmsAdmin/lib/viewer_functions.php";
list($regionsRecords, $selectedCategory) = getRegions(array(
'tableName' => 'regions',
));
list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
));
?>
In the body:
<ul>
<?php foreach ($regionsRecords as $regionsRecord): ?>
<?php echo $categoryRecord['_listItemStart'] ?>
<?php if ($categoryRecord['_isSelected']): ?><b><?php endif ?>
<li><a href="listings.php?category=<?php echo $categoryRecord['num'] ?>"><?php echo $categoryRecord['name'] ?></a> </li>
<?php if ($categoryRecord['_isSelected']): ?></b><?php endif ?>
<?php echo $categoryRecord['_listItemEnd'] ?>
<?php endforeach ?>
</ul>
What am I missing here?