Original geschrieben von TobiaZ 
was soll man dazu ohne code sagen?
	was soll man dazu ohne code sagen?
PHP-Code:
	
	
<? include_once("/www/htdocs/v097157/menu/db_fns.php");
/********************************************************************
alarisMenu
Mysql driven DHTML menu generator written in PHP and JavaScript
Copyright (c) 2002 Rasmus L. Petersen @ [url]http://www.alaris.dk[/url]
You are free to use and change this script as long as this message
and ALL copyright messages are intact!
Available at [url]http://www.alaris.dk[/url]
*********************************************************************/
$version = "2.0";
/* CONFIGURE YOUR DATABASE SETTINGS; */
$db_server = "localhost";
$db_user = "LOGIN";
$db_password = "DBPasswort";
$db_database = "LOGIN";
/* CONFIGURE THE LAYOUT TO FIT YOUR NEEDS; */
# Distance from the top
    $alaris_top = "85";
# Width of the topbar menu
    $alaris_width = "600";
# Distance of first layer from left relative to the topbar
# try different values to fit your needs
    $alaris_left = "78";
# Menu background color
    $alaris_bgcolor = "#cccc99";
# Mouse over color
    $alaris_mocolor = "#999966";
# Submenu background color
    $alaris_sub_bgcolor = "#ffffff";
# Sub Mouse over color
          $alaris_sub_mocolor = "#999966";
# Submenu table width
    $alaris_subtable_width = "160";
/* FUNCTIONS RETURNS PHP TO BUILD OBJECTS; */
function menu(){
  global $result_array;
    
  db_connect();
  $query = "SELECT * FROM alaris_menu";
  $result = mysql_query($query);
  $result_array = array();
  db_close();
  while($row = mysql_fetch_array($result)){
     $result_array[] = $row;    
  }
  return $result_array;
}
function sub_menu($id){
  global $result_array;
    
  db_connect();
  $query = "SELECT * FROM alaris_sub_menu WHERE parent_id=$id ORDER BY title_sub";
  $result = mysql_query($query);
  $result_array = array();
  db_close();
  while($row = mysql_fetch_array($result)){
     $result_array[] = $row;    
  }
  return $result_array;
}
$top_menu = menu();
for($i=0;$i<count($top_menu);$i++){
    extract($top_menu[$i]);
    $menu[$i]=new menu("$parent_id","$title","$width","$url","$target");
    
    $sub_menu=sub_menu($parent_id);
    for($j=0;$jcount($sub_menu);$j++){
       extract($sub_menu[$j]);
              $submenu[$i][$j]=new submenu("$sub_id","$title_sub","$url_sub","$target_sub");
              
    }
}
/* INSTANTIATING THE MENU AND SUBMENU CLASSES */
class menu {
     function menu($parent_id,$title, $width, $url, $target) {
            $this->PARENT_ID = $parent_id;
            $this->TITLE = $title;
        $this->WIDTH = $width;
        $this->URL = $url;
        $this->TARGET = $target;
    }
}
class submenu {
     function submenu($sub_id,$title, $url, $target_sub) {
               $this->SUB_ID = $sub_id;
               $this->TITLE = $title;
        $this->URL = $url;
        $this->TARGET = $target_sub;
    }
}
?>
EDIT: 
php-tags by tobiaz
BTW: es hätte vollkommen gereicht, die entsprechende stelle zu posten.
          
 Moderator
							
						
 
 ... aber wohin denn ?
							
						
							
						
Kommentar