	<?php
	function legendMenu($thisPage, $curPage, &$menusID, &$menusSub, &$legendName, $parent=0) {
		if ($parent > 0) {
			$sql7 = "select * from menus WHERE menusID = '$parent' ";
		} else {
			$sql7 = "select * from menus WHERE menusLink = '$curPage' ";
		}
		if ($hasil7 = mysql_query($sql7)) {
			while ($data7 = mysql_fetch_array($hasil7)) {
				if ($parent == 0) {
					$menusID = $data7["menusID"];
					$menusSub = $data7["menusSub"];
					$legendName = '
					<div class="M060 hide-for-small">
						<div class="row">
							<div class="rowInner">
								<div style="padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;" class="col l-col12 m-col12 s-col12">
									<a href="'.$thisPage.'">Homepage</a>
									<span class="breadcrumbSpacer">&gt;</span>';
				}
				
				if ($data7["menusIDParent"] > 0) {
					legendMenu($thisPage, $curPage, $menusID, $menusSub, $legendName, $data7["menusIDParent"]);
					$legendName .= '<span class="breadcrumbSpacer">&gt;</span>';
				}
				
				$legendName .= '<a href="'.$thisPage.$data7["menusLink"].'">'.$data7["menusName"].'</a>';

				if ($parent == 0) {
					$legendName .= '
								</div>	
							</div>		
						</div>			
					</div>';
				}
			}
		}
	}

	//Menu 
	$actual_link = $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
	$curPage = str_replace($thisPage, "", $actual_link);
	$curPage = str_replace("index.php", "", $curPage);
	$legendName = "";
	$menusID = 0;
	$menusSub = "";
	
	$curPageArr = explode("/",$curPage);
	//echo "<br> curPage : ".$curPage;
	
	legendMenu($thisPage, $curPage, $menusID, $menusSub, $legendName, 0);
	?>