Det ser mere ud som om, at du har defineret funktionen inde i et loop, så funktionen forsøges defineret flere gange.
Må vi se menu.php?
Ja.. kategorien er area og underkategorier er content..
<?session_start();?>
<?include('config/config.php')?>
<?include('include/check.php')?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="da" lang="da">
<head>
<link href="/admin/css/context.css" type="text/css" rel="stylesheet" />
<link href="/admin/css/tree.css" type="text/css" rel="stylesheet" />
<script src="/admin/js/context.js" type="text/javascript"></script>
<script src="/admin/js/tree.js" type="text/javascript"></script>
<script type="text/javascript">SimpleContextMenu.setup({'preventDefault':true, 'preventForms':false});<?$result = mysql_query("SELECT * FROM ".$db_prefix."content");while($row = mysql_fetch_array($result)){echo "SimpleContextMenu.attach('context".$row["id"]."', 'CM".$row["id"]."');";}?></script>
</head>
<body>
<?
//Context menu
$result = mysql_query("SELECT * FROM ".$db_prefix."content where deleted <> 1");
while($row = mysql_fetch_array($result))
{
echo '<ul class="SimpleContextMenu" id="CM'.$row['id'].'"><li><a target="right" href="edit_pages.php?action=add&id='.$row['id'].'">Opret underside</a></li><li><a href="edit_pages.php?action=edit&id='.$row['id'].'" target="right">Rediger</a></li></ul>';
}
?>
<ul id="sitemap">
<?
$result_area = mysql_query("SELECT * FROM ".$db_prefix."areas");
while($row = mysql_fetch_array($result_area))
{
$area = $row['id']; //Set area
echo '<li><a href="/admin/edit_areas.php?id='.$row['id'].'" target="right">'.$row['title'].'</a>'; //Write area title
// get all menuitems with 1 query
$result = mysql_query("SELECT id, parent, title FROM ".$db_prefix."content where area = '$area' order by sort");
// prepare special array with parent-child relations
$menuData = array(
'items' => array(),
'parents' => array()
);
while ($menuItem = mysql_fetch_assoc($result))
{
$menuData['items'][$menuItem['id']] = $menuItem;
$menuData['parents'][$menuItem['parent']][] = $menuItem['id'];
}
// menu builder function, parentId 0 is the root
function buildMenu($parent, $menuData)
{
$html = '';
if (isset($menuData['parents'][$parent]))
{
$html = '<ul>';
foreach ($menuData['parents'][$parent] as $itemId)
{
$html .= '<li><a target="right" class="context'.$menuData['items'][$itemId]['id'].'" href="edit_pages.php?action=edit&id='.$menuData['items'][$itemId]['id'].'">' . $menuData['items'][$itemId]['title'].'</a> <a target="right" href="edit_pages.php?action=add&id='.$menuData['items'][$itemId]['id'].'">Opret underside</a>';
// find childitems recursively
$html .= buildMenu($itemId, $menuData);
$html .= '</li>';
}
$html .= '</ul>';
}
return $html;
}
// output the menu
echo buildMenu(0, $menuData);
echo "</li>";
}
?>
</ul>
</body>
</html>