All pastes #383132 Raw Edit

Something

public php v1 · immutable
·published 2007-03-06 03:39 UTC
rendered paste body
/*** Utility function to recursively work through a vertically indented* hierarchial menu*/function mosRecurseListMenu( $id, $level, &$children, $open, &$indents, $class_sfx, $highlight ) {	global $Itemid;	global $HTTP_SERVER_VARS, $mosConfig_live_site;	if (@$children[$id]) {		$n = min( $level, count( $indents )-1 );		        echo $indents[$n][0];		foreach ($children[$id] as $row) {			switch ($row->type) {          		case 'separator':          		// do nothing          		$row->link = "seperator";          		break; // Kills the foreach?                    		case 'url':          		if ( eregi( 'index.php\?', $row->link ) ) {        				if ( !eregi( 'Itemid=', $row->link ) ) {        					$row->link .= '&Itemid='. $row->id;        				}        			}          		break; // Kills the foreach?                    		default:          			$row->link .= "&Itemid=$row->id";                    		break; // Kills the foreach?          	}            $li =  "\n".$indents[$n][1] ;            $current_itemid = trim( mosGetParam( $_REQUEST, 'Itemid', 0 ) );            if ($row->link != "seperator" &&								$current_itemid == $row->id ||             		$row->id == $highlight ||                 (sefRelToAbs( substr($_SERVER['PHP_SELF'],0,-9) . $row->link)) == $_SERVER['REQUEST_URI'] ||                (sefRelToAbs( substr($_SERVER['PHP_SELF'],0,-9) . $row->link)) == $HTTP_SERVER_VARS['REQUEST_URI']) {							$li = "<li class='active'>";						}	          echo $li;	          								            echo mosGetLink( $row, $level, $class_sfx );						mosRecurseListMenu( $row->id, $level+1, $children, $open, $indents, $class_sfx, "" );            echo $indents[$n][2];                    }		echo "\n".$indents[$n][3];	}}