';
foreach($menu as $option)
{
$subcount = 0;
$showsub = TRUE;
foreach($option as $text=>$link)
{
if(!$showsub){break;}
if($subcount == 0)
{
// MAIN MENU OPTION
// DETERMINE IF IT IS ACTIVE
// IT IS ACTIVE IF WE ARE ON ITS LINK OR ANY OF ITS SUBMENUS LINKS
$main_active = FALSE;
//echo ' link: '.$link.' :: script: '.$_SERVER['SCRIPT_NAME'];
if($link == Utilities::strip_index_file($_SERVER['SCRIPT_NAME'], 'index.hello'))//
{
$main_active = TRUE;
}
else
{
// LOOP THROUGH THIS ARRAY AGAIN
$subcount_inner = 0;
foreach($option as $text_inner=>$link_inner)
{
// IF IT HAS BEEN DETERMINED STOP LOOP
if($main_active){break;}
// SKIP THE MAIN ONE
if($subcount_inner > 0)
{
if($link_inner == $_SERVER['SCRIPT_NAME'])
{
$main_active = TRUE;
}
}
++$subcount_inner;
}
}
if($main_active)
{
// MAIN OPTIONS ALWAYS LINK
$cell_class = "adminmenuoptionsmainactive";
$menu_cell = '>'.$text.'';
}
else
{
$cell_class = "menuoptionsmain";
$menu_cell = '::'.$text.'';
// DO NOT DISPLAY SUBMENU OPTIONS
$showsub = FALSE;
}
}
else
{
// SUB MENU OPTION
// DETERMINE IF IT IS ACTIVE
$sub_active = FALSE;
//echo 'link: '.$link.' filename: '.$filename.' ';
if($link == $_SERVER['SCRIPT_NAME'])
{
$sub_active = TRUE;
}
if($sub_active)
{
// ALWAYS LINK TOO
$cell_class = "menuoptionssubactive";
$menu_cell = ' >'.$text.'';
}
else
{
$cell_class = "menuoptionssub";
$menu_cell = ' ..'.$text.'';
}
}
$menuhtml .= '