All pastes #917977 Raw Edit

get menue

public php v1 · immutable
#917977 ·published 2008-02-25 20:29 UTC
rendered paste body
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;}