ich habe in der SuFu einen Thread entdeckt (externer Link und habe nun mein Menü geändert. Im Moment wird die Ebene 2/3 erst angezeigt wenn man auf den richtigen Punkt in der Ebene 1 klickt.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | <?php // Copyright by Manuel // Support www.ilch.de defined ( 'main' ) or die ( 'no direct access' ); if (!isset( $ILCH_HEADER_ADDITIONS )) { $ILCH_HEADER_ADDITIONS = '' ; } if (!isset( $ILCH_BODYEND_ADDITIONS )) { $ILCH_BODYEND_ADDITIONS = '' ; } class design extends tpl { var $html ; var $design ; var $vars ; var $was ; var $file ; function design ( $title , $hmenu , $was = 1, $file = null) { global $allgAr ; if (! is_null ( $file )) { echo '<div style="display: block; background-color: #FFFFFF; border: 2px solid #ff0000;">!!Man konnte in einer PHP Datei eine spezielle Index angeben. Damit das Design fuer diese Datei anders aussieht. Diese Funktion wurde ersetzt. Weitere Informationen im Forum auf ilch.de ... Thema: <a href="http://www.ilch.de/forum-showposts-13758-p1.html#108812">http://www.ilch.de/forum-showposts-13758-p1.html#108812</a></div>' ; } $this ->vars = array (); $this ->file = $file ; # setzte das file standart 0 weil durch was definiert $this ->was = $was ; # 0 = smalindex, 1 = normal index , 2 = admin $this ->design = $this ->get_design(); $link = $this ->htmlfile(); $tpl = new tpl ( $link , 2); if ( $tpl ->list_exists ( 'boxleft' )) { $tpl ->set ( 'boxleft' , $this ->get_boxes ( 'l' , $tpl )); } if ( $tpl ->list_exists ( 'boxright' )) { $tpl ->set ( 'boxright' , $this ->get_boxes ( 'r' , $tpl )); } // ab 0.6 = ... 5 menu listen moeglich for ( $i = 1; $i <= 5; $i ++) { if ( $tpl ->list_exists ( 'menunr' . $i )) { $tpl ->set ( 'menunr' . $i , $this ->get_boxes ( $i , $tpl )); } } $ar = array ( 'TITLE' => $this ->escape_explode( $title ), 'HMENU' => $this ->escape_explode( $hmenu ), 'SITENAME' => $this ->escape_explode( $allgAr [ 'title' ]), 'hmenuende' => '' , 'vmenuende' => '' , 'hmenubegi' => '' , 'vmenubegi' => '' , 'hmenupoint' => '' , 'vmenupoint' => '' , 'DESIGN' => $this ->design ); $tpl ->set_ar( $ar ); $this ->html = $tpl ->get(0); $this ->html .= '{EXPLODE}' ; $this ->html .= $tpl ->get(1); unset ( $tpl ); $zsave0 = array (); preg_match_all ( "/\{_boxes_([^\{\}]+)\}/" , $this ->html , $zsave0 ); $this ->replace_boxes( $zsave0 [1]); unset ( $zsave0 ); $this ->vars_replace(); unset ( $this ->vars); $this ->html = explode ( '{EXPLODE}' , $this ->html); } function addheader( $text ) { if (isset( $this ->html[0])) { $this ->html[0] = str_replace ( '</head>' , $text . "\n</head>" , $this ->html[0] ); return true; } else { return false; } } function header () { global $ILCH_HEADER_ADDITIONS ; $this ->addheader( $ILCH_HEADER_ADDITIONS ); echo $this ->html[0]; unset ( $this ->html[0]); } function addtobodyend( $text ) { if (isset( $this ->html[1])) { $this ->html[1] = str_replace ( '</body>' , $text . "\n</body>" , $this ->html[1] ); return true; } else { return false; } } function footer ( $exit = 0) { global $ILCH_BODYEND_ADDITIONS ; $this ->addtobodyend( $ILCH_BODYEND_ADDITIONS ); echo $this ->html[1]; unset ( $this ->html[1]); if ( $exit == 1) { exit (); } } function escape_explode ( $s ) { $s = str_replace ( '{EXPLODE}' , '{EXPLODE}' , $s ); return ( $s ); } function htmlfile_ini () { global $menu ; $ma = $menu ->get_string_ar(); $ia = array (); if (! file_exists ( 'include/designs/' . $this ->design . '/design.ini' )) { return (false); } $ia = parse_ini_file ( 'include/designs/' . $this ->design . '/design.ini' ); arsort( $ma ); krsort ( $ia ); foreach ( $ia as $k => $v ) { $k = preg_replace( "/[^a-zA-Z0-9-*]/" , "" , $k ); $k = str_replace ( '*' , '[^-]+' , $k ); foreach ( $ma as $k1 => $v1 ) { if (preg_match( "/" . $k . "/" , $k1 ) AND file_exists ( 'include/designs/' . $this ->design . '/' . $v )) { return ( $v ); } } } return (false); } function htmlfile () { $ini = $this ->htmlfile_ini (); /* if ( !is_null ($this->file) AND file_exists ('include/designs/'.$this->design.'/templates/'.$this->file)) { $f = 'designs/'.$this->design.'/templates/'.$this->file; } elseif ( !is_null ($this->file) AND file_exists ('include/templates/'.$this->file)) { $f = 'templates/'.$this->file; */ if ( $this ->was == 1 AND $ini !== false) { $f = 'designs/' . $this ->design . '/' . $ini ; } elseif ( $this ->was == 0 AND file_exists ( 'include/templates/' . $this ->design . '/templates/small_index.htm' )) { $f = 'templates/' . $this ->design . '/templates/small_index.htm' ; } elseif ( $this ->was == 0) { $f = 'templates/small_index.htm' ; } elseif ( $this ->was == 1) { $f = 'designs/' . $this ->design . '/index.htm' ; } elseif ( $this ->was == 2) { $f = 'admin/templates/index.htm' ; } return ( $f ); } function replace_boxes ( $zsave0 ) { foreach ( $zsave0 as $v ) { $dat = strtolower ( $v ); $buffer = $this ->get_boxcontent ( $dat ); if ( $buffer !== false) { $this ->vars[ '_boxes_' . $v ] = $buffer ; } } if (! is_array ( $this ->vars)) { $this ->vars = array (); } } function vars_replace() { foreach ( $this ->vars as $k => $v ) { $this ->html = str_replace ( '{' . $k . '}' , $v , $this ->html); } } // #### function get_boxes ( $wo , $tpl ) { global $lang , $allgAr , $menu ; if ( is_numeric ( $wo )) { $datei = 'menunr' . $wo ; } elseif ( $wo == 'l' ) { $datei = 'boxleft' ; $wo = 1; } elseif ( $wo == 'r' ) { $datei = 'boxright' ; $wo = 2; } $retur = '' ; $ex_ebene = 0; $ex_was = 1; $firstmep = false; $hovmenup = '' ; $abf = "SELECT * FROM `prefix_menu` WHERE wo = " . $wo . " AND ( recht >= " . $_SESSION [ 'authright' ] . " OR recht = 0 ) ORDER by pos" ; $erg = db_query( $abf ); while ( $r = db_fetch_assoc( $erg )) { $menuar [ $r [ 'pos' ]] = $r ; $menupaths [ $r [ 'path' ]] = $r [ 'pos' ]; } //Aktiven Punkt herausfinden foreach ( array_reverse ( $menu ->get_string_ar()) as $path ){ $path = str_replace ( 'self-' , '' , $path ); if (isset( $menupaths [ $path ])) { $act_pos = $menupaths [ $path ]; break ; } } //Punkte löschen, die nicht angezeigt werden sollen $todel = array (); //Punkte davor for ( $i = $act_pos ; $i > -1; $i --){ if (isset( $menuar [ $i ]) and $menuar [ $i ][ 'ebene' ] == 0) { $todel_before = $i ; break ; } } $todel_after = count ( $menuar ); for ( $i = $act_pos +1; $i < $todel_after ; $i ++){ if (isset( $menuar [ $i ]) and $menuar [ $i ][ 'ebene' ] == 0) { $todel_after = $i ; break ; } } foreach ( $menuar as $pos => $row ) { if ( $row [ 'ebene' ] > 0 and ( $pos < $todel_before or $pos > $todel_after )) { continue ; } $subhauptx = $row [ 'was' ]; $whileMenP = ( $subhauptx >= 7 ? true : false); if (( $row [ 'was' ] >= 7 AND $ex_was == 1) OR ( $ex_ebene < ( $row [ 'ebene' ]-1)) OR ( $ex_was <= 4 AND $row [ 'ebene' ] <> 0) OR ( $row [ 'was' ] >= 7 AND ! $tpl ->list_exists( $hovmenup ))) { continue ; } // nur wenn ein menu in die variable $menuzw geschrieben wurde // wird in diese if abfrage gesprungen if (( $whileMenP === false) AND ! empty ( $menuzw )) { $menuzw .= $this ->get_boxes_get_menu_close ( $ex_ebene , 0, $menuzw , $wmpE , $wmpTE , $wmpTEE ); $retur .= $tpl ->list_get( $datei , array (htmlentities( $boxname ), $menuzw . $menuzwE )); $menuzw = '' ; } if ( $row [ 'was' ] == 1) { // die box wird direkt in die to return variable geschrieben $buffer = $this ->get_boxcontent( $row [ 'path' ]); $retur .= $tpl ->list_get( $datei , array ( $row [ 'name' ] , $buffer )); } elseif ( $row [ 'was' ] >= 2 AND $row [ 'was' ] <= 4) { // der name des menues wird gesetzt // und die variable wird gesetzt. $boxname = $row [ 'name' ]; $menuzw = '' ; $menuzwE = '' ; $ex_ebene = 0; # ex ebene $hovmenu = '' ; if ( $row [ 'was' ] == 2 AND $tpl ->list_exists( 'hmenupoint' )) { $hovmenu = 'hmenu' ; } elseif ( $row [ 'was' ] == 3 AND $tpl ->list_exists( 'vmenupoint' )) { $hovmenu = 'vmenu' ; } $firstmep = true; if (! empty ( $hovmenu )) { $menuzw .= $tpl ->list_get( $hovmenu . 'begi' , array ()); $menuzwE .= $tpl ->list_get( $hovmenu . 'ende' , array ()); } $hovmenup = $hovmenu . 'point' ; } elseif ( $whileMenP ) { // menupunkt wird generiert $ebene = $row [ 'ebene' ]; $menuTarget = ( $subhauptx == 8 ? '_blank' : '_self' ); list ( $wmpA , $wmpE , $wmpTE , $wmpTEE ) = explode ( '|' , $tpl ->list_get ( $hovmenup , array ( $menuTarget , ( $subhauptx == 8 ? '' : 'index.php?' ) . $row [ 'path' ], $row [ 'name' ], ( $row [ 'pos' ] == $act_pos ? 'active' : 'inactive' )))); if (! empty ( $menuzw ) AND $firstmep === false) { $menuzw .= $this ->get_boxes_get_menu_close ( $ex_ebene , $ebene , $menuzw , $wmpE , $wmpTE , $wmpTEE ); } $menuzw .= $wmpA ; $firstmep = false; } $ex_was = $row [ 'was' ]; $ex_ebene = $row [ 'ebene' ]; } if (! empty ( $menuzw )) { $menuzw .= $this ->get_boxes_get_menu_close ( $ex_ebene , 0, $menuzw , $wmpE , $wmpTE , $wmpTEE ); $retur .= $tpl ->list_get( $datei , array (htmlentities( $boxname ), $menuzw . $menuzwE )); } return ( $retur ); } function get_boxes_get_menu_close ( $ex_ebene , $ebene , $menuzw , $wmpE , $wmpTE , $wmpTEE ) { $menu1 = '' ; if ( $ex_ebene == $ebene AND ! empty ( $menuzw )) { $menu1 .= $wmpE . "\n" ; } elseif ( $ex_ebene > $ebene ) { $menu1 .= $wmpE . "\n" ; for ( $i = 0; $i < ( $ex_ebene - $ebene ); $i ++) { $menu1 .= $wmpTEE . "\n" ; } } elseif ( $ex_ebene < $ebene ) { $menu1 .= $wmpTE . "\n" ; } return ( $menu1 ); } function get_boxcontent ( $box ) { global $lang , $allgAr , $menu , $ILCH_HEADER_ADDITIONS , $ILCH_BODYEND_ADDITIONS ; if ( file_exists ( 'include/boxes/' . $box )) { $pfad = 'include/boxes/' . $box ; } elseif ( file_exists ( 'include/contents/selfbp/selfb/' . str_replace ( 'self_' , '' , $box ))) { $pfad = 'include/contents/selfbp/selfb/' . str_replace ( 'self_' , '' , $box ); } elseif ( file_exists ( 'include/boxes/' . $box . '.php' )) { $pfad = 'include/boxes/' . $box . '.php' ; } elseif ( file_exists ( 'include/boxes/' . $box . '.htm' )) { $pfad = 'include/boxes/' . $box . '.htm' ; } elseif ( file_exists ( 'include/contents/selfbp/selfb/' . str_replace ( 'self_' , '' , $box ) . '.php' )) { $pfad = 'include/contents/selfbp/selfb/' . str_replace ( 'self_' , '' , $box ) . '.php' ; } elseif ( file_exists ( 'include/contents/selfbp/selfb/' . str_replace ( 'self_' , '' , $box ) . '.htm' )) { $pfad = 'include/contents/selfbp/selfb/' . str_replace ( 'self_' , '' , $box ) . '.htm' ; } else { return (false); } ob_start(); require_once ( $pfad ); $buffer = $this ->escape_explode(ob_get_contents()); ob_end_clean(); return ( $buffer ); } } ?> |
Ich hätte jetzt aber gerne das der Punkt "Wars" aus der 3. Ebene erst angezeigt wird, wenn man den Menüpunkt der Ebene 2 anklickt. Kann mir vielleicht einer sagen was ich dort noch ändern muss?
Achja, die Lösung mit der design.ini kommt für mich nicht in Frage, da das Menü dynamisch sein muss!
Gruß Estridsson
Zuletzt modifiziert von Estridsson am 02.01.2012 - 11:14:03