Example #1
0
		/**
		 * Returns a menu-object with the menu corresponding to the path
		 * @param string Path to query for a new menu-object. format "/page1/page2/page3"
		 */
		function getMenuByPath($path="/") {
			$liste = explode("/", strtoupper($path));
			if ($path == "/" || $path=="") {
				$management = new Management($this);
				$page = $management->getStartPage($this->variation);	
			} else {
				if ($this->level != 0) {
			    	$page = getDBCell("state_translation", "OUT_ID", "IN_ID=0 AND LEVEL=".$this->level);
		    	} else {
				    $page = 0;
			    }
			
		    	for ($i = 1; $i < count($liste); $i++) {
			    	if ($page == "")
				    	$page = 0;

			    	if ($liste[$i] != "") 
				    	$page = getDBCell("sitemap", "MENU_ID", "PARENT_ID=$page AND UPPER(NAME)='" . $liste[$i] . "'");
				    }   
			    if ($page != "") 
				    $page = getDBCell("sitepage", "SPID", "MENU_ID=$page AND DELETED=0");
			}
	
		    if ($page == "") $page = getDBCell("state_translation", "OUT_ID", "IN_ID=0 AND LEVEL=".$this->level);	
		    return $this->createInstance(null, $page, $this->variation, $this->level);		
		}