<?php
	require_once "/../init.php";
	list($listingRecords, $listingDetails) = getRecords(array(
		'tableName' => 'table1',
		'where' => whereRecordNumberInUrl(1),
		'limit' => '1',
	));
	
	$listing = @$listingRecords[0];
	if (!$listing) { print "Listing not found!"; exit; }

	// load all pages for menu (put this table 1) 
	list($listingRecords, $listingDetails) = getRecords(array(    
		'tableName'   => 'table1',    
		'allowSearch' => '0',
	)); 

	// load all pages for menu (put this table 2) 
	list($listingtwoRecords, $listingDetails) = getRecords(array(    
		'tableName'   => 'table2',    
		'allowSearch' => '0',
	)); 

$num = getNumberFromEndOfUrl();


	list($categoryRecords, $selectedCategory) = getCategories(array(
		'tableName'				=> 'menu',
		'selectedCategoryNum'	=> '3',			// defaults to getNumberFromEndOfUrl()
		'categoryFormat'		=> 'showall',	// showall, onelevel, twolevel
	));

?>
<!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" />
</head>
<body>

<div style="width:480px">
Detail...<br />
<?php echo $listing['title'] ?><br />
<?php echo $listing['content'] ?><br />
...<br />
</div>



<!-- menu list listingDetails -->
<div style="width:480px">

<b>Menu</b><br /><br />

<b>Table 1</b> ( ../sale/house/ )<br />

<?php foreach ($listingRecords as $record): ?>
	<?php if ($num == $record['num']): ?>
		<li><b><?php echo $record['title'] ?></b></li>
	<?php else: ?> 
		<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></li>
	<?php endif; ?>
<?php endforeach; ?>

<br /><br />

<b>Table 2</b> ( ../sale/apartment/ ) <br />

<?php foreach ($listingtwoRecords as $record): ?>
	<?php if ($num == $record['num']): ?>
		<li><b><?php echo $record['title'] ?></b></li>
	<?php else: ?> 
		<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></li>
	<?php endif; ?>
<?php endforeach; ?>

</div>
<!-- /menu list listingDetails -->




<!-- menu category -->
<div style="width:100%">
<?php foreach ($categoryRecords as $categoryRecord): ?>
    <?php if ($categoryRecord['_isSelected']): ?>
		<b><a href="<?php echo $categoryRecord['_link'] ?>/"><?php echo $categoryRecord['name'] ?></a></b>
    <?php else: ?>
		<a href="<?php echo $categoryRecord['_link'] ?>/"><?php echo $categoryRecord['name'] ?></a>
    <?php endif; ?>
<?php endforeach; ?>
</div>
<!-- /menu category -->





</body>
</html>