function get_menu($str) { global $cfg, $menuAll, $menuChildren, $page; $offsetx = -4; $ret = ''; foreach ($menuAll as $key => $value) { if ($value[0] == '') { $tmp = str_replace('{:id:}' ,$key , $str); $tmp = str_replace('{:link:}' ,'?'.$cfg['page_par'].'='.$menuChildren[$key][0] , $tmp); $tmp = str_replace('{:width:}' ,$value[4] , $tmp); $tmp = str_replace('{:height:}' ,$cfg['menu_bheight'], $tmp); $tmp = str_replace('{:offsetx:}',$offsetx , $tmp); $margin = $key == 'home' ? 'margin-left: 11px; ' : ''; $tmp = str_replace('{:margin:}' ,$margin , $tmp); if ($key == $page['id'] || $key == $menuAll[$page['id']][0]) { $tmp = str_replace('{:img:}' ,'m_' .$key. '.jpg' , $tmp); } else { $tmp = str_replace('{:img:}' ,'0.gif' , $tmp); } if ($key == $page['id']) { $tmp = str_replace('{:url:}' ,'#' , $tmp); } else { $tmp = str_replace('{:url:}' ,$_SERVER['PHP_SELF']. '?' .$cfg['page_par']. '=' .$key, $tmp); } $ret .= $tmp; $offsetx+= $value[4]; } } return $ret; }