$istr"; $istr=ereg_replace($needle,$newneedle,$istr); $pstr.=substr($tstr,0,$pos[0]).$istr; $tstr=substr($tstr,$pos[0]+$pos[1],strlen($tstr)); $pos=getInnerStrpos($tstr, $startNeedle, $endNeedle); } $pstr.=substr($tstr,0,strlen($tstr)); } else{ $pstr=substr($haystack,$pos[0],$pos[1]); $pstr=ereg_replace($needle,$newneedle,$pstr); $pstr=substr($haystack,0,$pos[0]).$pstr.substr($haystack,$pos[1]+$pos[0],strlen($haystack)); } } return $pstr; } function getInnerStrpos($haystack, $startNeedle, $endNeedle) { $pos1=strpos($haystack, $startNeedle); $startNeedleWidth=strlen($startNeedle); $tstr=substr($haystack,$pos1+$startNeedleWidth,strlen($haystack)); $pos2=strpos($tstr, $endNeedle); if(is_numeric($pos2))$pos2=$pos2+strlen($startNeedle)+strlen($endNeedle); $spos[0]=$pos1; $spos[1]=$pos2; return $spos; } function chopInnerText($haystack, $startNeedle, $endNeedle, $loopthru=1, $keepvars=0) { /* This function returns a specified string with the text removed between the specified start string and end string. $haystack is the string you want manipulating $startNeedle is the starting point to look for $endNeedle is the point at which text stops being deleted if $loopthru is true, loops through the text until no other $start_txt to $end_txt can be found $keepvars leaves the $startNeedle and $endNeedle variables in the text string */ $pstr=$haystack; $pos=getInnerStrpos($haystack, $startNeedle, $endNeedle); if(is_numeric($pos[0]) && is_numeric($pos[1])) { if($loopthru) { $tstr=$pstr; $pstr=""; while(is_numeric($pos[0]) && is_numeric($pos[1])) { if($keepvars) { $pstr.=substr($tstr,0,$pos[0]+strlen($startNeedle)); $tstr=substr($tstr,$pos[0]+$pos[1],strlen($tstr)); } else { $pstr.=substr($tstr,0,$pos[0]); $tstr=substr($tstr,$pos[0]+$pos[1],strlen($tstr)); } $pos=getInnerStrpos($tstr, $startNeedle, $endNeedle); } $pstr.=substr($tstr,0,strlen($tstr)+1); } else { if($keepvars) { $pstr=substr($haystack,0,$pos[0]+strlen($startNeedle)); $pstr.=substr($haystack,$pos[1]+$pos[0]-strlen($endNeedle),strlen($haystack)); } else { $pstr=substr($haystack,0,$pos[0]); $pstr.=substr($haystack,$pos[1]+$pos[0],strlen($haystack)); } } } return $pstr; } function fileContents($filename) { $file=fopen($filename, "r"); $dFF=""; while(!feof($file)) { $dFF .= fread($file, 4096); } return $dFF; } $ftext=fileContents("menu.xml"); $level=0; $ftext=ereg_replace("\r","",$ftext); $ftext=ereg_replace("\n","",$ftext); $ftext = chopInnerText($ftext, "", 1, 0); $ftext = chopInnerText($ftext, "", 1, 0); $xmlA=split("<",$ftext); $menucode=""; $endlevel=-1; for($a=1;$a1) { $level--; $newLevel=true; if($level<$endlevel) { $splitProp=split(">",substr($xmlA[$a],1,strlen($xmlA[$a]))); if($splitProp[0]=="style" || $splitProp[0]=="menu")$menucode.="}\n\n"; if($splitProp[0]=="menuitem")$menucode.="\");\n"; //echo "END - '$splitProp[0]'"; //$menucode.="}"; } //$menucode.=";
"; $endlevel=$level; } } else { $splitProp=split(">",$xmlA[$a]); if(count($splitProp)==2 && ord($splitProp[1])>32) { //$xmlA[$a]="$splitProp[0]=$splitProp[1]"; if($old!="menuitem") { if($splitProp[0]=="style") { $menucode.="$splitProp[0]=$splitProp[1];\n"; } else { $menucode.="$splitProp[0]=\"$splitProp[1]\";\n"; } } else { $menucode.="$splitProp[0]=$splitProp[1];"; } } else { $old=$splitProp[0]; $splitProp=split(" ",$splitProp[0]); if(count($splitProp)==1) { //$xmlA[$a]="New Object = $splitProp[0]"; if($splitProp[0]=="menuitem") { $menucode.="aI(\""; } } else { $old = replaceInnerText($old, "\"", "\"", "=", "MILONICEQUALS", 1); $old = replaceInnerText($old, "\"", "\"", " ", "MILONICSPACE", 1); $old = replaceInnerText($old, "'", "'", "=", "MILONICEQUALS", 1); $old = replaceInnerText($old, "'", "'", " ", "MILONICSPACE", 1); $old=ereg_replace("\"","",$old); $old=ereg_replace("'","",$old); $splitProp=split(" ",$old); //$xmlA[$a]="$splitProp[0]"; for($b=1;$b$level $xmlA[$a]
"; } if($newLevel) { $level--; } } $pathToCodeFiles="../../"; $file_milonicsrc="milonic_src.js"; $file_mmenudom="mmenudom.js"; $file_mmenuns4="mmenuns4.js"; echo " "; echo ""; echo "JavaScript Menu Powered by Milonic






This menu is built using the file menu.xml "; ?>