Help Parsing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Sloth
Forum Newbie
Posts: 18
Joined: Thu Dec 07, 2006 7:29 pm

Help Parsing

Post by Sloth »

http://pastebin.ca/271081

This is the data I want to parse

Code: Select all

<html>
<head>
<link rel="stylesheet" type="text/css" href="demo.css" />
<link rel="stylesheet" type="text/css" href="office_xp/office_xp.css" />
<script type="text/javascript" src="jsdomenu.js"></script>
<script type="text/javascript" src="jsdomenubar.js"></script>
<script type="text/javascript">
<?php
include("config.php");


//temp variables delete later please
$SCRIPT_PATH = ".";
$menuid = "SMS100000";
$lang = "BC";
//end temp

$cache = "$SCRIPT_PATH/cache";
$filename = "$cache/$menuid$lang";


if (file_exists($filename)) {
	$handle = fopen($filename, "r");
	$contents = fread($handle, filesize($filename));
	fclose($handle);
	$data = unserialize($contents);
	echo $data;
} else {
	$js = 'function createjsDOMenu() { '.chr(13);


	//please substitue this function to retrieve data from database
	$arrInput = file("menu2.txt");
	$strInput = flatten($arrInput);
	//end substitiion
	/*
	Sample 
	$data = dbSelect("Select * from menubar where something = 'something'");
	$strInput = $data[1][menuitem];
	*/
	

	preg_match_all('/{.*}/',$strInput, $match);
	$arrMenu = clearBlanks($match[0]);



	$mainmenu = getChild(0);



	//submenu
	for ($mainctr=0;($mainctr<=count($mainmenu)-1);$mainctr++) {
		$js .= createJS(1,($mainmenu[$mainctr]+1),($mainmenu[($mainctr+1)]));

	}

	//main menu
	$js .= '  absoluteMenuBar = new jsDOMenuBar("static", "staticMenuBar");
	  with (absoluteMenuBar) {';
	for ($k=0;$k<(count($mainmenu));$k++) {
		$dat = getName($arrMenu[($mainmenu[$k])]);
		$js .=	'addMenuBarItem(new menuBarItem("'.$dat[name].'", absoluteMenu'.$k.'));'.chr(13);
	}
	$js .= '}'.chr(13);
	//end main menu


	$js .= $ccjs.chr(13);
	$js .= $ccjs2.chr(13);
	$js .= $ccjs3.chr(13);
	$js .= $linking.chr(13);
	$js .= $exlink.chr(13);
	$js .= $exlink2.chr(13);
	$js .= '} '.chr(13);

	//Prints out the JS

	$data = ($js);
	$handle = fopen($filename,"w+");
	fwrite($handle,$data);
	fclose($handle);

}
?>

</script>
</head>

<body onLoad="initjsDOMenu()">

<div id="staticMenuBar"></div>
<pre>
<?php
echo $filename;


function createJS($level,$start=0,$stop=0) {
	global $arrMenu,$mainctr,$mainmenu,$ccjs,$done,$childcounter,$linking,$done2;
	$childcounter=0;
	$done = false;
	$men = 110 + $mainctr * 10;
	$absmen = 'absoluteMenu'.$mainctr;


	$js .= $absmen.' = new jsDOMenu('.$men.', "absolute");'.chr(13);
	$js .= ' with ('.$absmen.') {'.chr(13);
	$menu1 = getChild($level,$start,$stop);
	$done = $menu1;
	//print_r($menu1);
	for ($j=0;$j<(count($menu1));$j++) {
		$dat = getName($arrMenu[$menu1[$j]]);
		if (hasChild($arrMenu[$menu1[$j]])==true) {
			$xtra = 'Item'.$mainctr.'_'.$j; 
			$done2 = $j;
			
			$jj = $j+1;
			if ($jj >= count($menu1) ) {
				$kk = $mainmenu[($mainctr+1)];
			} else {
				$kk = $menu1[$j+1];
			}
			$sub = getChild($level+1,$menu1[$j],$kk);
			$lev[0]=$j;
			//echo "<<$j>>";
			$ccjs .= createJS1($sub,$lev);
			//$linking .= 
			

			//print_R($sub);
			$childcounter++;
		} else {
			$xtra = '';
		}
		$js .= 'addMenuItem(new menuItem("'.$dat[name].'", "'.$xtra.'", "'.$dat[url].'"));'.chr(13);
	}
	$js .= '}'.chr(13);
	return $js;
}

function createJS1($arrInput,$lev) {
	global $arrMenu,$mainctr,$ccjs,$done,$childcounter,$linking,$done2,$temp,$mainmenu,$ccjs2;
	$men = 110 + $mainctr * 10;
	$absmen = 'absoluteMenu'.$mainctr;
	$items  = $mainctr;
	foreach ($lev as $arr) {
		$absmen .= '_'.$arr;
		$items .= '_'.$arr;
	}
	$lalala = "";

		//echo "<<!!!!!!!!!!!!!!!!!!!!!>>";
		//print_r($lev);
		for($i=1;$i<count($lev);$i++) {
			$lalala .= "_".$lev[$i];
		}
		

	
	$xx = count($lev);
	$level = $xx + 1;
	//echo $level."!!!!!!!<br/>";

	$js .= $absmen.' = new jsDOMenu('.$men.', "absolute");'.chr(13);
	$js .= ' with ('.$absmen.') {'.chr(13);
	for ($j=0;$j<(count($arrInput));$j++) {
		$dat = getName($arrMenu[$arrInput[$j]]);
		$temp = $arrInput[($j+1)];
		if (!isset($arrInput[($j+1)])) {
			$temp  = $mainmenu[$mainctr+1];
		}
		if (hasChild($arrMenu[$arrInput[$j]])==true) {
			$xtra = 'Item'.$items.'_'.$j; 
			$jj = $j+1;
			if ($jj >= count($menu1) ) {
				$kk = $done[($done2+1)];
			} else {
				$kk = $arrInput[$j+1];
			}
			$sub = getChild2(($level+1),$arrInput[$j],$temp);
			$lev[$xx] = $j;

			$ccjs2 .= createJS2($sub,$lev);

		} else {
			$xtra = '';
		}
		$js .= 'addMenuItem(new menuItem("'.$dat[name].'", "'.$xtra.'", "'.$dat[url].'"));'.chr(13);

		
	}
	$js .= '}'.chr(13);

	$linking .= 'absoluteMenu'.$mainctr.$lalala.'.items.Item'.$items.'.setSubMenu('.$absmen.');'.chr(13);
	return $js;
}


function createJS2($arrInput,$lev) {
	global $arrMenu,$mainctr,$ccjs,$done,$childcounter,$linking,$done2,$temp,$mainmenu,$exlink,$ccjs3;
	$men = 110 + $mainctr * 10;
	$absmen = 'absoluteMenu'.$mainctr;
	$items  = $mainctr;
	foreach ($lev as $arr) {
		$absmen .= '_'.$arr;
		$items .= '_'.$arr;
	}
	$lalala = "$mainctr";
	$lalala .= "_".$lev[0];
	$xx = count($lev);
	$level = $xx + 1;

	$js .= $absmen.' = new jsDOMenu('.$men.', "absolute");'.chr(13);
	$js .= ' with ('.$absmen.') {'.chr(13);
	for ($j=0;$j<(count($arrInput));$j++) {
		$dat = getName($arrMenu[$arrInput[$j]]);
		$temp = $arrInput[($j+1)];
		if (!isset($arrInput[($j+1)])) {
			$temp  = $mainmenu[$mainctr];
		}
		if (hasChild($arrMenu[$arrInput[$j]])==true) {
			$xtra = 'Item'.$items.'_'.$j; 
			$jj = $j+1;
			if ($jj >= count($menu1) ) {
				$kk = $done[($done2+1)];
			} else {
				$kk = $arrInput[$j+1];
			}
			$sub = getChild2(($level+1),$arrInput[$j],$temp);
			$lev[$xx] = $j;

			$ccjs3 .= createJS3($sub,$lev);

		} else {
			$xtra = '';
		}
		$js .= 'addMenuItem(new menuItem("'.$dat[name].'", "'.$xtra.'", "'.$dat[url].'"));'.chr(13);
	}
	$js .= '}'.chr(13);
	$exlink .= 'absoluteMenu'.$lalala.'.items.Item'.$items.'.setSubMenu('.$absmen.');'.chr(13);
	return $js;
}

function createJS3($arrInput,$lev) {
	global $arrMenu,$mainctr,$ccjs,$ccjs3,$done,$childcounter,$linking,$done2,$temp,$mainmenu,$exlink,$ccjs2,$exlink2;
	$men = 110 + $mainctr * 10;
	$absmen = 'absoluteMenu'.$mainctr;
	$items  = $mainctr;
	foreach ($lev as $arr) {
		$absmen .= '_'.$arr;
		$items .= '_'.$arr;
	}
	$lalala = "$mainctr";
	$lalala .= "_".$lev[0]."_".$lev[1];
	$xx = count($lev);
	$level = $xx + 2;
	$js .= $absmen.' = new jsDOMenu('.$men.', "absolute");'.chr(13);
	//echo $absmen.' = new jsDOMenu('.$men.', "absolute");'.chr(13)."!!!!!!!!!!!!!!!!!!!!!!!!!!AAAAAAAAAAAAAAAAAAAAAA";
	$js .= ' with ('.$absmen.') {'.chr(13);
	for ($j=0;$j<(count($arrInput));$j++) {
		$dat = getName($arrMenu[$arrInput[$j]]);
		$js .= 'addMenuItem(new menuItem("'.$dat[name].'", "'.$xtra.'", "'.$dat[url].'"));'.chr(13);
	}
	$js .= '}'.chr(13);
	$exlink2 .= 'absoluteMenu'.$lalala.'.items.Item'.$items.'.setSubMenu('.$absmen.');'.chr(13);
	//echo $js;
	return $js;
}

function createJS4($arrInput,$lev) {
	echo "lalala";

}
function getChild($level,$start=0,$stop=0) {
	global $arrMenu;
	if ($stop==0)  { 
		$stop=count($arrMenu);
	}


	for ($i=$start;$i <= $stop;$i++) {
		if (isset($arrMenu[$i])) {
			if (getCount($arrMenu[$i])==$level) {
				$ret[] = $i;
			}
		}
	}
	return $ret;
}

function getChild2($level,$start=0,$stop=0) {
	global $arrMenu,$temp;
	if ($stop==0)  { 
		$stop=$temp;
	}


	for ($i=$start;$i <= $stop;$i++) {
		if (isset($arrMenu[$i])) {
			if (getCount($arrMenu[$i])==$level) {
				$ret[] = $i;
			}
		}
	}
	return $ret;
}


function hasChild($strData) {
		global $arrMenu;
		$data = explode(",",$strData);
		if (isset($data[1])) {
			return false;
		} else {
			return true;
		}
}

function getCount($strData) {
	$data = explode("|",$strData);
	$cnt = (count($data)-1);
	return $cnt;
}

function getName($strData) {
		$data = explode(",",$strData);
		if (isset($data[1])) {
			$ret[name] = str_replace("|","",$data[0]);
			$ret[url] = $data[1];
			
		} else {
			$ret[name] = str_replace("|","",$data[0]);
			$ret[url] = "blank.htm";
		}
		return $ret;
		
}

function flatten($array) {
	$txt = "";
	foreach ($array as $arr) {
		$txt .= $arr;
	}
	return $txt;
}

function clearBlanks($arrInput) {
	foreach ($arrInput as $arr) {
		if (strstr($arr, chr(13))==false) {
			$arr = str_replace("{","",$arr);
			$arr = str_replace("}","",$arr);
			$retData[] = $arr;
		}
	}
	return $retData;
	
}
?>
</pre>

</body>
</html>
Basically what I want to do is parse through the text file above and generate a DHTML based menu off it. I've got it working (barely) but I wonder if there's anyway to streamline the above code, its rather messy for now =(
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Are you talking about working through the text in the link?
Sloth
Forum Newbie
Posts: 18
Joined: Thu Dec 07, 2006 7:29 pm

Post by Sloth »

basically what I want to do is take the 1st set of data and transform it into something the javascript menubar can read

Code: Select all

function createjsDOMenu() { absoluteMenu1 = new jsDOMenu(120, "absolute"); with (absoluteMenu1) { addMenuItem(new menuItem("Item 1", "", "blank.htm")); addMenuItem(new menuItem("Item 2", "item2", "blank.htm")); addMenuItem(new menuItem("Item 3", "", "blank.htm")); addMenuItem(new menuItem("-")); addMenuItem(new menuItem("Item 4", "", "blank.htm")); addMenuItem(new menuItem("Item 5", "", "blank.htm")); } absoluteMenu1_1 = new jsDOMenu(120, "absolute"); with (absoluteMenu1_1) { addMenuItem(new menuItem("Item 1", "", "blank.htm")); addMenuItem(new menuItem("-")); addMenuItem(new menuItem("Item 2", "", "blank.htm")); addMenuItem(new menuItem("Item 3", "", "blank.htm")); addMenuItem(new menuItem("-")); addMenuItem(new menuItem("Item 4", "", "blank.htm")); } absoluteMenu2 = new jsDOMenu(120, "absolute"); with (absoluteMenu2) { addMenuItem(new menuItem("Item 1", "", "blank.htm")); addMenuItem(new menuItem("Item 2", "", "blank.htm")); addMenuItem(new menuItem("Item 3", "", "blank.htm")); addMenuItem(new menuItem("-")); addMenuItem(new menuItem("Item 4", "item4", "blank.htm")); } absoluteMenu2_1 = new jsDOMenu(120, "absolute"); with (absoluteMenu2_1) { addMenuItem(new menuItem("Item 1", "", "blank.htm")); addMenuItem(new menuItem("-")); addMenuItem(new menuItem("Item 2", "", "blank.htm")); addMenuItem(new menuItem("Item 3", "", "blank.htm")); addMenuItem(new menuItem("Item 4", "", "blank.htm")); addMenuItem(new menuItem("Item 5", "", "blank.htm")); } absoluteMenu3 = new jsDOMenu(140, "absolute"); with (absoluteMenu3) { addMenuItem(new menuItem("Item 1", "item1", "blank.htm")); addMenuItem(new menuItem("Item 2", "", "blank.htm")); addMenuItem(new menuItem("-")); addMenuItem(new menuItem("Item 3", "", "blank.htm")); addMenuItem(new menuItem("Item 4", "", "blank.htm")); } absoluteMenu3_1 = new jsDOMenu(150, "absolute"); with (absoluteMenu3_1) { addMenuItem(new menuItem("Item 1", "", "blank.htm")); addMenuItem(new menuItem("-")); addMenuItem(new menuItem("Item 2", "", "blank.htm")); addMenuItem(new menuItem("-")); addMenuItem(new menuItem("Item 3", "", "blank.htm")); addMenuItem(new menuItem("-")); addMenuItem(new menuItem("Item 4", "", "blank.htm")); addMenuItem(new menuItem("Item 5", "", "blank.htm")); } absoluteMenuSch = new jsDOMenu(120, "absolute"); with (absoluteMenuSch) { addMenuItem(new menuItem("Johore","MenuSch_01","")); addMenuItem(new menuItem("Kedah","MenuSch_02","")); addMenuItem(new menuItem("Kelantan","MenuSch_03","")); addMenuItem(new menuItem("Kuala Lumpur","MenuSch_04","")); addMenuItem(new menuItem("Labuan","MenuSch_05","")); addMenuItem(new menuItem("Melaka","MenuSch_06","")); addMenuItem(new menuItem("Negeri Sembilan","MenuSch_07","")); addMenuItem(new menuItem("Pahang","MenuSch_08","")); addMenuItem(new menuItem("Penang","MenuSch_09","")); addMenuItem(new menuItem("Perak","MenuSch_10","")); addMenuItem(new menuItem("Perlis","MenuSch_11","")); addMenuItem(new menuItem("Putrajaya","MenuSch_12","")); addMenuItem(new menuItem("Sabah","MenuSch_14","")); addMenuItem(new menuItem("Sarawak","MenuSch_15","")); addMenuItem(new menuItem("Selangor","MenuSch_16","")); addMenuItem(new menuItem("Terengganu","MenuSch_17","")); } absoluteMenuSch_01 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_01 ) { addMenuItem(new menuItem("SMJK PAI CHEE","","/school/index.php?schid=49")); addMenuItem(new menuItem("SMJK PEI HWA","","/school/index.php?schid=50")); addMenuItem(new menuItem("SMJK SEG HWA","","/school/index.php?schid=51")); }absoluteMenuSch_02 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_02 ) { addMenuItem(new menuItem("SMJK KEAT HWA (2)","","/school/index.php?schid=10")); addMenuItem(new menuItem("SMJK CHIO MIN","","/school/index.php?schid=9")); addMenuItem(new menuItem("SMJK KEAT HWA (1)","","/school/index.php?schid=7")); addMenuItem(new menuItem("SMJK SIN MIN","","/school/index.php?schid=8")); }absoluteMenuSch_03 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_03 ) { addMenuItem(new menuItem("SMJK CHUNG HWA","","/school/index.php?schid=59")); addMenuItem(new menuItem("SMJK CHUNG CHENG","","/school/index.php?schid=60")); }absoluteMenuSch_04 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_04 ) { addMenuItem(new menuItem("SMJK CHONG HWA KUALA LUMPUR","","/school/index.php?schid=39")); addMenuItem(new menuItem("SMJK CONFUCIAN","","/school/index.php?schid=40")); }absoluteMenuSch_05 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_05 ) { }absoluteMenuSch_06 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_06 ) { addMenuItem(new menuItem("SMJK KATHOLIK","","/school/index.php?schid=44")); addMenuItem(new menuItem("SMJK NOTRE DAME CONVENT","","/school/index.php?schid=45")); addMenuItem(new menuItem("SMJK YOK BIN","","/school/index.php?schid=48")); addMenuItem(new menuItem("SMJK TINGGI CINA","","/school/index.php?schid=47")); addMenuItem(new menuItem("SMJK PULAU SEBANG","","/school/index.php?schid=46")); }absoluteMenuSch_07 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_07 ) { addMenuItem(new menuItem("SMJK CHUNG HUA","","/school/index.php?schid=42")); addMenuItem(new menuItem("SMJK CHI WEN","","/school/index.php?schid=43")); addMenuItem(new menuItem("SMJK CHAN WA","","/school/index.php?schid=41")); }absoluteMenuSch_08 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_08 ) { addMenuItem(new menuItem("SMJK CHUNG CHING","","/school/index.php?schid=55")); addMenuItem(new menuItem("SMJK TANAH PUTIH","","/school/index.php?schid=54")); addMenuItem(new menuItem("SMJK CHUNG HWA","","/school/index.php?schid=56")); addMenuItem(new menuItem("SMJK TRIANG","","/school/index.php?schid=57")); addMenuItem(new menuItem("SMJK KATHOLIK","","/school/index.php?schid=53")); addMenuItem(new menuItem("SMJK KHAI MUN","","/school/index.php?schid=58")); addMenuItem(new menuItem("SMJK HWA LIAN","","/school/index.php?schid=52")); }absoluteMenuSch_09 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_09 ) { addMenuItem(new menuItem("SMJK HENG EE","","/school/index.php?schid=15")); addMenuItem(new menuItem("SMJK PHOR TAY","","/school/index.php?schid=18")); addMenuItem(new menuItem("SMJK SACRED HEART","","/school/index.php?schid=19")); addMenuItem(new menuItem("SMJK CONVENT DATUK KERAMAT","","/school/index.php?schid=13")); addMenuItem(new menuItem("SMJK CHUNG HWA CONFUCIAN","","/school/index.php?schid=16")); addMenuItem(new menuItem("SMJK UNION","","/school/index.php?schid=20")); addMenuItem(new menuItem("SMJK CHUNG LING BUTTERWORTH","","/school/index.php?schid=14")); addMenuItem(new menuItem("SMJK CHUNG LING PULAU PINANG","","/school/index.php?schid=12")); addMenuItem(new menuItem("SMJK PEREMPUAN CHINA PULAU PINANG","","/school/index.php?schid=17")); addMenuItem(new menuItem("SMJK JIT SIN","","/school/index.php?schid=11")); }absoluteMenuSch_10 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_10 ) { addMenuItem(new menuItem("SMJK PEI YUAN","","/school/index.php?schid=31")); addMenuItem(new menuItem("SMJK HUA LIAN","","/school/index.php?schid=27")); addMenuItem(new menuItem("SMJK AYER TAWAR ","","/school/index.php?schid=24")); addMenuItem(new menuItem("SMJK CHOONG HUA","","/school/index.php?schid=25")); addMenuItem(new menuItem("SMJK KATHOLIK","","/school/index.php?schid=22")); addMenuItem(new menuItem("SMJK YUK CHOY","","/school/index.php?schid=36")); addMenuItem(new menuItem("SMJK Perempuan Perak","","/school/index.php?schid=32")); addMenuItem(new menuItem("SMJK AVE MARIA CONVENT","","/school/index.php?schid=23")); addMenuItem(new menuItem("SMJK POI LAM","","/school/index.php?schid=28")); addMenuItem(new menuItem("SMJK SHING CHUNG","","/school/index.php?schid=37")); addMenuItem(new menuItem("SMJK YUK KWAN","","/school/index.php?schid=34")); addMenuItem(new menuItem("SMJK SAN MIN","","/school/index.php?schid=38")); addMenuItem(new menuItem("SMJK NAN HWA","","/school/index.php?schid=30")); addMenuItem(new menuItem("SMJK TSUNG WAH ","","/school/index.php?schid=33")); addMenuItem(new menuItem("SMJK SAM TET","","/school/index.php?schid=35")); addMenuItem(new menuItem("SMJK KRIAN","","/school/index.php?schid=29")); addMenuItem(new menuItem("SMJK DINDINGS","","/school/index.php?schid=26")); }absoluteMenuSch_11 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_11 ) { addMenuItem(new menuItem("SMJK PERLIS","","/school/index.php?schid=6")); }absoluteMenuSch_12 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_12 ) { }absoluteMenuSch_14 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_14 ) { addMenuItem(new menuItem("Heaven","","/school/index.php?schid=90")); addMenuItem(new menuItem("SMJK SUNG SIEW","","/school/index.php?schid=75")); addMenuItem(new menuItem("SMJK LOK YUK LIKAS","","/school/index.php?schid=76")); addMenuItem(new menuItem("SMJK CHUNG HWA","","/school/index.php?schid=74")); addMenuItem(new menuItem("SMJK SHAN TAO","","/school/index.php?schid=77")); addMenuItem(new menuItem("SM KEN HWA","","/school/index.php?schid=71")); addMenuItem(new menuItem("SMJK TINGGI KOTA KINABALU","","/school/index.php?schid=72")); addMenuItem(new menuItem("SMJK LOK YUK MILE 1","","/school/index.php?schid=78")); addMenuItem(new menuItem("SMJK TIONG HUA","","/school/index.php?schid=73")); }absoluteMenuSch_15 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_15 ) { addMenuItem(new menuItem("Happy","","/school/index.php?schid=91")); addMenuItem(new menuItem("SMJK KWONG HUA","","/school/index.php?schid=70")); addMenuItem(new menuItem("SMJK CHUNG HUA MIRI","","/school/index.php?schid=86")); addMenuItem(new menuItem("SMB TONG HUA","","/school/index.php?schid=68")); addMenuItem(new menuItem("SMB TIONG HIN","","/school/index.php?schid=62")); addMenuItem(new menuItem("SMJK CHUNG HUA","","/school/index.php?schid=63")); addMenuItem(new menuItem("SMK TINGGI","","/school/index.php?schid=67")); addMenuItem(new menuItem("Sacred Heart","","/school/index.php?schid=87")); addMenuItem(new menuItem("PERRIDOT TEST","","/school/index.php?schid=85")); addMenuItem(new menuItem("SMB CHUNG CHENG","","/school/index.php?schid=66")); addMenuItem(new menuItem("SMB KWONG HWA","","/school/index.php?schid=65")); addMenuItem(new menuItem("SMJK TUNG HUA","","/school/index.php?schid=64")); addMenuItem(new menuItem("SMJK KUCHING HIGH","","/school/index.php?schid=61")); addMenuItem(new menuItem("SMJK KAI CHUNG","","/school/index.php?schid=69")); addMenuItem(new menuItem("Paradise","","/school/index.php?schid=89")); addMenuItem(new menuItem("Paradise ","","/school/index.php?schid=93")); }absoluteMenuSch_16 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_16 ) { addMenuItem(new menuItem("SMJK KWANG HUA","","/school/index.php?schid=4")); addMenuItem(new menuItem("SMJK YU HUA","","/school/index.php?schid=1")); addMenuItem(new menuItem("SMJK YOKE KUAN","","/school/index.php?schid=5")); addMenuItem(new menuItem("SMJK CHUNG HWA","","/school/index.php?schid=2")); addMenuItem(new menuItem("SMJK KATHOLIK","","/school/index.php?schid=3")); }absoluteMenuSch_17 = new jsDOMenu(200, "absolute"); with (absoluteMenuSch_17 ) { addMenuItem(new menuItem("SMJK CHUNG HWA WEI SIN","","/school/index.php?schid=21")); } absoluteMenuSch.items.MenuSch_01.setSubMenu(absoluteMenuSch_01); absoluteMenuSch.items.MenuSch_02.setSubMenu(absoluteMenuSch_02); absoluteMenuSch.items.MenuSch_03.setSubMenu(absoluteMenuSch_03); absoluteMenuSch.items.MenuSch_04.setSubMenu(absoluteMenuSch_04); absoluteMenuSch.items.MenuSch_05.setSubMenu(absoluteMenuSch_05); absoluteMenuSch.items.MenuSch_06.setSubMenu(absoluteMenuSch_06); absoluteMenuSch.items.MenuSch_07.setSubMenu(absoluteMenuSch_07); absoluteMenuSch.items.MenuSch_08.setSubMenu(absoluteMenuSch_08); absoluteMenuSch.items.MenuSch_09.setSubMenu(absoluteMenuSch_09); absoluteMenuSch.items.MenuSch_10.setSubMenu(absoluteMenuSch_10); absoluteMenuSch.items.MenuSch_11.setSubMenu(absoluteMenuSch_11); absoluteMenuSch.items.MenuSch_12.setSubMenu(absoluteMenuSch_12); absoluteMenuSch.items.MenuSch_14.setSubMenu(absoluteMenuSch_14); absoluteMenuSch.items.MenuSch_15.setSubMenu(absoluteMenuSch_15); absoluteMenuSch.items.MenuSch_16.setSubMenu(absoluteMenuSch_16); absoluteMenuSch.items.MenuSch_17.setSubMenu(absoluteMenuSch_17); absoluteMenu1.items.item2.setSubMenu(absoluteMenu1_1); absoluteMenu2.items.item4.setSubMenu(absoluteMenu2_1); absoluteMenu3.items.item1.setSubMenu(absoluteMenu3_1); absoluteMenuBar = new jsDOMenuBar("static", "staticMenuBar"); with (absoluteMenuBar) { addMenuBarItem(new menuBarItem("Item 1", absoluteMenu1)); addMenuBarItem(new menuBarItem("Item 2", absoluteMenu2)); addMenuBarItem(new menuBarItem("Item 3", absoluteMenu3)); addMenuBarItem(new menuBarItem("##School_List##", absoluteMenuSch)); } }
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

basically what I want to do is take the 1st set of data and transform it into something the javascript menubar can read
Where is the data coming from?
Post Reply